id int64 0 25.6k | text stringlengths 0 4.59k |
|---|---|
17,100 | this model has lot more coefficients (also called weightsto learnthere is one between every input and every hidden unit (which make up the hidden layer)and one between every unit in the hidden layer and the output computing series of weighted sums is mathematically the same as computing just one weighted sumso to make ... |
17,101 | tion function for the small neural network pictured in figure - the full formula for computing in the case of regression would be (when using tanh nonlinearity) [ tanh( [ [ [ [ [ [ [ [ ] [ tanh( [ [ [ [ [ [ [ [ ] [ tanh( [ [ [ [ [ [ [ [ ] [ [ [ [ [ [ herew are the weights between the input and the hidden layer hand are... |
17,102 | mglearn plots plot_two_hidden_layer_graph(figure - multilayer perceptron with two hidden layers having large neural networks made up of many of these layers of computation is what inspired the term "deep learning tuning neural networks let' look into the workings of the mlp by applying the mlpclassifier to the two_moon... |
17,103 | the two_moons dataset as you can seethe neural network learned very nonlinear but relatively smooth decision boundary we used algorithm=' -bfgs'which we will discuss later by defaultthe mlp uses hidden nodeswhich is quite lot for this small dataset we can reduce the number (which reduces the complexity of the modeland ... |
17,104 | the two_moons dataset with only hidden unitsthe decision boundary looks somewhat more ragged the default nonlinearity is relushown in figure - with single hidden layerthis means the decision function will be made up of straight line segments if we want smoother decision boundarywe could add more hidden units (as in fig... |
17,105 | using two hidden layerswith units eachnow with tanh nonlinearity mlp mlpclassifier(algorithm=' -bfgs'activation='tanh'random_state= hidden_layer_sizes=[ ]mlp fit(x_trainy_trainmglearn plots plot_ d_separator(mlpx_trainfill=truealpha mglearn discrete_scatter(x_train[: ]x_train[: ]y_trainplt xlabel("feature "plt ylabel("... |
17,106 | eachwith tanh activation function finallywe can also control the complexity of neural network by using an penalty to shrink the weights toward zeroas we did in ridge regression and the linear classifiers the parameter for this in the mlpclassifier is alpha (as in the linear regression models)and it' set to very low val... |
17,107 | tings of the alpha parameter as you probably have realized by nowthere are many ways to control the complexity of neural networkthe number of hidden layersthe number of units in each hidden layerand the regularization (alphathere are actually even morewhich we won' go into here an important property of neural networks ... |
17,108 | initializations to get better understanding of neural networks on real-world datalet' apply the mlpclassifier to the breast cancer dataset we start with the default parametersin[ ]print("cancer data per-feature maxima:\ {}format(cancer data max(axis= ))out[ ]cancer data per-feature maxima in[ ]x_trainx_testy_trainy_tes... |
17,109 | we will do this by hand herebut we'll introduce the standardscaler to do this automatically in in[ ]compute the mean value per feature on the training set mean_on_train x_train mean(axis= compute the standard deviation of each feature on the training set std_on_train x_train std(axis= subtract the meanand scale by inve... |
17,110 | the generalization performance stillthe model is performing quite well as there is some gap between the training and the test performancewe might try to decrease the model' complexity to get better generalization performance herewe choose to increase the alpha parameter (quite aggressivelyfrom to to add stronger regula... |
17,111 | breast cancer dataset one possible inference we can make is that features that have very small weights for all of the hidden units are "less importantto the model we can see that "mean smoothnessand "mean compactness,in addition to the features found between "smoothness errorand "fractal dimension error,have relatively... |
17,112 | ful ones--often take long time to train they also require careful preprocessing of the dataas we saw here similarly to svmsthey work best with "homogeneousdatawhere all the features have similar meanings for data that has very different kinds of featurestree-based models might work better tuning neural network paramete... |
17,113 | their definitions in the user guide when starting to work with mlpswe recommend sticking to 'adamand ' -bfgsfit resets model an important property of scikit-learn models is that calling fit will always reset everything model previously learned so if you build model on one datasetand then call fit again on different dat... |
17,114 | in the binary classification casethe return value of decision_function is of shape (n_samples,)and it returns one floating-point number for each samplein[ ]print("x_test shape{}format(x_test shape)print("decision function shape{}formatgbrt decision_function(x_testshape)out[ ]x_test shape( decision function shape( ,this... |
17,115 | make the boolean true/false into and greater_zero (gbrt decision_function(x_test astype(intuse and as indices into classes_ pred gbrt classes_[greater_zeropred is the same as the output of gbrt predict print("pred is equal to predictions{}formatnp all(pred =gbrt predict(x_test)))out[ ]pred is equal to predictionstrue t... |
17,116 | ing model on two-dimensional toy dataset encoding not only the predicted outcome but also how certain the classifier is provides additional information howeverin this visualizationit is hard to make out the boundary between the two classes predicting probabilities the output of predict_proba is probability for each cla... |
17,117 | predicted probabilities[ ]because the probabilities for the two classes sum to exactly one of the classes will be above certainty that class is the one that is predicted you can see in the previous output that the classifier is relatively certain for most points how well the uncertainty actually reflects uncertainty in... |
17,118 | ing model shown in figure - the boundaries in this plot are much more well-definedand the small areas of uncertainty are clearly visible the scikit-learn website has great comparison of many models and what their uncertainty estimates look like we've reproduced this in figure - and we encourage you to go though the exa... |
17,119 | from sklearn datasets import load_iris iris load_iris(x_trainx_testy_trainy_test train_test_splitiris datairis targetrandom_state= gbrt gradientboostingclassifier(learning_rate= random_state= gbrt fit(x_trainy_trainin[ ]print("decision function shape{}format(gbrt decision_function(x_testshape)plot the first few entries... |
17,120 | show the first few entries of predict_proba print("predicted probabilities:\ {}format(gbrt predict_proba(x_test)[: ])show that sums across rows are one print("sums{}format(gbrt predict_proba(x_test)[: sum(axis= ))out[ ]predicted probabilities[ ]sums we can again recover the predictions by computing the argmax of predic... |
17,121 | logreg logisticregression(represent each target by its class name in the iris dataset named_target iris target_names[y_trainlogreg fit(x_trainnamed_targetprint("unique classes in training data{}format(logreg classes_)print("predictions{}format(logreg predict(x_test)[: ])argmax_dec_func np argmax(logreg decision_functio... |
17,122 | for small datasetsgood as baselineeasy to explain linear models go-to as first algorithm to trygood for very large datasetsgood for very highdimensional data naive bayes only for classification even faster than linear modelsgood for very large datasets and high-dimensional data often less accurate than linear models de... |
17,123 | they are to the representation of the data while we analyzed the consequences of different parameter settings for the algorithms we investigatedbuilding model that actually generalizes well to new data in production is bit trickier than that we will see how to properly adjust parameters and how to find good parameters ... |
17,124 | unsupervised learning and preprocessing the second family of machine learning algorithms that we will discuss is unsupervised learning algorithms unsupervised learning subsumes all kinds of machine learning where there is no known outputno teacher to instruct the learning algorithm in unsupervised learningthe learning ... |
17,125 | the same person howeverthe site doesn' know which pictures show whomand it doesn' know how many different people appear in your photo collection sensible approach would be to extract all the faces and divide them into groups of faces that look similar hopefullythese correspond to the same personand the images can be gr... |
17,126 | different kinds of preprocessing the first plot in figure - shows synthetic two-class classification dataset with two features the first feature (the -axis valueis between and the second feature (the -axis valueis between around and the following four plots show four different ways to transform the data that yield more... |
17,127 | between and finallythe normalizer does very different kind of rescaling it scales each data point such that the feature vector has euclidean length of in other wordsit projects data point on the circle (or spherein the case of higher dimensionswith radius of this means every data point is scaled by different number (by... |
17,128 | maxscalerthe fit method computes the minimum and maximum value of each feature on the training set in contrast to the classifiers and regressors of the scaler is only provided with the data (x_trainwhen fit is calledand y_train is not usedin[ ]scaler fit(x_trainout[ ]minmaxscaler(copy=truefeature_range=( )to apply the ... |
17,129 | shifted and scaled you can see that all of the features are now between and as desired to apply the svm to the scaled datawe also need to transform the test set this is again done by calling the transform methodthis time on x_testin[ ]transform test data x_test_scaled scaler transform(x_testprint test data properties a... |
17,130 | =mglearn cm ( )label="training set" = axes[ scatter(x_test[: ]x_test[: ]marker='^' =mglearn cm ( )label="test set" = axes[ legend(loc='upper left'axes[ set_title("original data"scale the data using minmaxscaler scaler minmaxscaler(scaler fit(x_trainx_train_scaled scaler transform(x_trainx_test_scaled scaler transform(x... |
17,131 | circles and the test set shown as triangles the second panel is the same databut scaled using the minmaxscaler herewe called fit on the training setand then called transform on the training and test sets you can see that the dataset in the second panel looks identical to the firstonly the ticks on the axes have changed... |
17,132 | from sklearn svm import svc x_trainx_testy_trainy_test train_test_split(cancer datacancer targetrandom_state= svm svc( = svm fit(x_trainy_trainprint("test set accuracy{ }format(svm score(x_testy_test))out[ ]test set accuracy nowlet' scale the data using minmaxscaler before fitting the svcin[ ]preprocessing using - scal... |
17,133 | svm fit(x_train_scaledy_trainscoring on the scaled test set print("svm test accuracy{ }format(svm score(x_test_scaledy_test))out[ ]svm test accuracy now that we've seen how simple data transformations for preprocessing worklet' move on to more interesting transformations using unsupervised learning dimensionality reduc... |
17,134 | cess are called principal componentsas they are the main directions of variance in the data in generalthere are as many principal components as original features figure - transformation of data with pca the second plot (top rightshows the same databut now rotated so that the first principal component aligns with the -a... |
17,135 | two-dimensional dataset to one-dimensional dataset notehoweverthat instead of keeping only one of the original featureswe found the most interesting direction (top left to bottom right in the first paneland kept this directionthe first principal component finallywe can undo the rotation and add the mean back to the dat... |
17,136 | dimensionality reductionfeature extractionand manifold learning |
17,137 | appears with feature in certain range (called bineach plot overlays two histogramsone for all of the points in the benign class (blueand one for all the points in the malignant class (redthis gives us some idea of how each feature is distributed across the two classesand allows us to venture guess as to which features ... |
17,138 | original shape( reduced shape( we can now plot the first two principal components (figure - )in[ ]plot first vs second principal componentcolored by class plt figure(figsize=( )mglearn discrete_scatter(x_pca[: ]x_pca[: ]cancer targetplt legend(cancer target_namesloc="best"plt gca(set_aspect("equal"plt xlabel("first pri... |
17,139 | you can see that the two classes separate quite well in this two-dimensional space this leads us to believe that even linear classifier (that would learn line in this spacecould do reasonably good job at distinguishing the two classes we can also see that the malignant (redpoints are more spread out than the benign (bl... |
17,140 | you can see that in the first componentall features have the same sign (it' negativebut as we mentioned earlierit doesn' matter which direction the arrow points inthat means that there is general correlation between all features as one measurement is highthe others are likely to be high as well the second component has... |
17,141 | there are , imageseach pixels largebelonging to different peoplein[ ]print("people images shape{}format(people images shape)print("number of classes{}format(len(people target_names))out[ ]people images shape( number of classes the dataset is bit skewedhowevercontaining lot of images of george bush and colin powellas yo... |
17,142 | alejandro toledo amelie mauresmo angelina jolie atal bihari vajpayee carlos menem david beckham george bush gerhard schroeder gray davis hamid karzai hugo chavez laura bush lleyton hewitt mahmoud abbas michael bloomberg nestor kirchner pete sampras ricardo lagos rudolph giuliani serena williams tiger woods tom ridge vi... |
17,143 | model simple solution is to use one-nearest-neighbor classifier that looks for the most similar face image to the face you are classifying this classifier could in principle work with only single training example per class let' take look at how well kneighborsclassifier does herein[ ]from sklearn neighbors import kneig... |
17,144 | we fit the pca object to the training data and extract the first principal components then we transform the training and test datain[ ]pca pca(n_components= whiten=truerandom_state= fit(x_trainx_train_pca pca transform(x_trainx_test_pca pca transform(x_testprint("x_train_pca shape{}format(x_train_pca shape)out[ ]x_trai... |
17,145 | remember that components correspond to directions in the input space the input space here is -pixel grayscale imagesso directions within this space are also -pixel grayscale images let' look at the first couple of principal components (figure - )in[ ]print("pca components_ shape{}format(pca components_ shape)out[ ]pca ... |
17,146 | let' come back to the specific case of pcathough we introduced the pca transformation as rotating the data and then dropping the components with low variance another useful interpretation is to try to find some numbers (the new feature values after the pca rotationso that we can express the test points as weighted sum ... |
17,147 | the reconstructions of the original data using only some components in figure - after dropping the second component and arriving at the third panelwe undid the rotation and added the mean back to obtain new points in the original space with the second component removedas shown in the last panel we can do similar transf... |
17,148 | using as many components as there are pixels would mean that we would not discard any information after the rotationand we would reconstruct the image perfectly we can also try to use pca to visualize all the faces in the dataset in scatter plot using the first two principal components (figure - )with classes given by ... |
17,149 | non-negative matrix factorization is another unsupervised learning algorithm that aims to extract useful features it works similarly to pca and can also be used for dimensionality reduction as in pcawe are trying to write each data point as weighted sum of some componentsas illustrated in figure - but whereas in pca we... |
17,150 | nents (leftand one component (rightfor nmf with two componentsas shown on the leftit is clear that all points in the data can be written as positive combination of the two components if there are enough components to perfectly reconstruct the data (as many components as there are features)the algorithm will choose dire... |
17,151 | mglearn plots plot_nmf_faces(x_trainx_testimage_shapefigure - reconstructing three face images using increasing numbers of components found by nmf the quality of the back-transformed data is similar to when using pcabut slightly worse this is expectedas pca finds the optimum directions in terms of reconstruction nmf is... |
17,152 | from sklearn decomposition import nmf nmf nmf(n_components= random_state= nmf fit(x_trainx_train_nmf nmf transform(x_trainx_test_nmf nmf transform(x_testfixaxes plt subplots( figsize=( )subplot_kw={'xticks'()'yticks'()}for (componentaxin enumerate(zip(nmf components_axes ravel()))ax imshow(component reshape(image_shape... |
17,153 | compn sort by rd componentplot first images inds np argsort(x_train_nmf[:compn])[::- figaxes plt subplots( figsize=( )subplot_kw={'xticks'()'yticks'()}for (indaxin enumerate(zip(indsaxes ravel()))ax imshow(x_train[indreshape(image_shape)compn sort by th componentplot first images inds np argsort(x_train_nmf[:compn])[::... |
17,154 | as expectedfaces that have high coefficient for component are faces looking to the right (figure - )while faces with high coefficient for component are looking to the left (figure - as mentioned earlierextracting patterns like these works best for data with additive structureincluding audiogene expressionand text data ... |
17,155 | all three of them we want to recover the decomposition of the mixed signal into the original components we assume that we have many different ways to observe the mixture (say measurement devices)each of which provides us with series of measurementsin[ ]mix data into -dimensional state np random randomstate( uniform(siz... |
17,156 | the figure includes of the measurements from for reference as you can seenmf did reasonable job of discovering the original sourceswhile pca failed and used the first component to explain the majority of the variation in the data keep in mind that the components produced by nmf have no natural ordering in this examplet... |
17,157 | used to generate more than two new features some of themincluding -snecompute new representation of the training databut don' allow transformations of new data this means these algorithms cannot be applied to test setratherthey can only transform the data they were trained for manifold learning can be useful for explor... |
17,158 | let' use pca to visualize the data reduced to two dimensions we plot the first two principal componentsand color each dot by its class (see figure - )in[ ]build pca model pca pca(n_components= pca fit(digits datatransform the digits data onto the first two principal components digits_pca pca transform(digits datacolors... |
17,159 | let' apply -sne to the same datasetand compare the results as -sne does not support transforming new datathe tsne class has no transform method insteadwe can call the fit_transform methodwhich will build the model and immediately return the transformed data (see figure - )in[ ]from sklearn manifold import tsne tsne tsn... |
17,160 | plt figure(figsize=( )plt xlim(digits_tsne[: min()digits_tsne[: max( plt ylim(digits_tsne[: min()digits_tsne[: max( for in range(len(digits data))actually plot the digits as text instead of using scatter plt text(digits_tsne[ ]digits_tsne[ ]str(digits target[ ])color colors[digits target[ ]]fontdict={'weight''bold''siz... |
17,161 | the ones and nines are somewhat split upbut most of the classes form single dense group keep in mind that this method has no knowledge of the class labelsit is completely unsupervised stillit can find representation of the data in two dimensions that clearly separates the classesbased solely on how close points are in ... |
17,162 | cluster centers are shown as triangleswhile data points are shown as circles colors indicate cluster membership we specified that we are looking for three clustersso the algorithm was initialized by declaring three data points randomly as cluster centers (see "initialization"then the iterative algorithm starts firsteac... |
17,163 | applying -means with scikit-learn is quite straightforward herewe apply it to the synthetic data that we used for the preceding plots we instantiate the kmeans classand set the number of clusters we are looking for then we call the fit method with the datain[ ]from sklearn datasets import make_blobs from sklearn cluste... |
17,164 | print("cluster memberships:\ {}format(kmeans labels_)out[ ]cluster memberships[ as we asked for three clustersthe clusters are numbered to you can also assign cluster labels to new pointsusing the predict method each new point is assigned to the closest cluster center when predictingbut the existing model is not change... |
17,165 | clusters we can also use more or fewer cluster centers (figure - )in[ ]figaxes plt subplots( figsize=( )using two cluster centerskmeans kmeans(n_clusters= kmeans fit(xassignments kmeans labels_ mglearn discrete_scatter( [: ] [: ]assignmentsax=axes[ ]using five cluster centerskmeans kmeans(n_clusters= kmeans fit(xassign... |
17,166 | clusters (rightfailure cases of -means even if you know the "rightnumber of clusters for given datasetk-means might not always be able to recover them each cluster is defined solely by its centerwhich means that each cluster is convex shape as result of thisk-means can only capture relatively simple shapes -means also ... |
17,167 | densities one might have expected the dense region in the lower left to be the first clusterthe dense region in the upper right to be the secondand the less dense region in the center to be the third insteadboth cluster and cluster have some points that are far away from all the other points in these clusters that "rea... |
17,168 | kmeans kmeans(n_clusters= kmeans fit(xy_pred kmeans predict(xplot the cluster assignments and cluster centers plt scatter( [: ] [: ] =y_predcmap=mglearn cm plt scatter(kmeans cluster_centers_[: ]kmeans cluster_centers_[: ]marker='^' =[ ] = linewidth= cmap=mglearn cm plt xlabel("feature "plt ylabel("feature "figure - -m... |
17,169 | plt scatter( [: ] [: ] =y_predcmap=mglearn cm = plt scatter(kmeans cluster_centers_[: ]kmeans cluster_centers_[: ]marker='^' =[mglearn cm ( )mglearn cm ( )] = linewidth= plt xlabel("feature "plt ylabel("feature "figure - -means fails to identify clusters with complex shapes herewe would hope that the clustering algorit... |
17,170 | nents extracted (figure - )as well as reconstructions of faces from the test set using components (figure - for -meansthe reconstruction is the closest cluster center found on the training setin[ ]x_trainx_testy_trainy_test train_test_splitx_peopley_peoplestratify=y_peoplerandom_state= nmf nmf(n_components= random_stat... |
17,171 | unsupervised learning and preprocessing |
17,172 | components (or cluster centers)-- -means uses only single cluster center per image an interesting aspect of vector quantization using -means is that we can use many more clusters than input dimensions to encode our data let' go back to the two_moons data using pca or nmfthere is nothing much we can do to this dataas it... |
17,173 | xy make_moons(n_samples= noise= random_state= kmeans kmeans(n_clusters= random_state= kmeans fit(xy_pred kmeans predict(xplt scatter( [: ] [: ] =y_preds= cmap='paired'plt scatter(kmeans cluster_centers_[: ]kmeans cluster_centers_[: ] = marker='^' =range(kmeans n_clusters)linewidth= cmap='paired'plt xlabel("feature "plt... |
17,174 | between and we can see this as the data being represented using components (that iswe have new features)with all features being apart from the one that represents the cluster center the point is assigned to using this -dimensional representationit would now be possible to separate the two half-moon shapes using linear ... |
17,175 | agglomerative clustering refers to collection of clustering algorithms that all build upon the same principlesthe algorithm starts by declaring each point its own clusterand then merges the two most similar clusters until some stopping criterion is satisfied the stopping criterion implemented in scikit-learn is the num... |
17,176 | initiallyeach point is its own cluster thenin each stepthe two clusters that are closest are merged in the first four stepstwo single-point clusters are picked and these are joined into two-point clusters in step one of the two-point clusters is extended to third pointand so on in step there are only three clusters rem... |
17,177 | as expectedthe algorithm recovers the clustering perfectly while the scikit-learn implementation of agglomerative clustering requires you to specify the number of clusters you want the algorithm to findagglomerative clustering methods provide some help with choosing the right numberwhich we will discuss next hierarchic... |
17,178 | tive clusteringwith numbered data points (cf figure - while this visualization provides very detailed view of the hierarchical clusteringit relies on the two-dimensional nature of the data and therefore cannot be used on datasets that have more than two features there ishoweveranother tool to visualize hierarchical clu... |
17,179 | between clusters dendrogram(linkage_arraymark the cuts in the tree that signify two or three clusters ax plt gca(bounds ax get_xbound(ax plot(bounds[ ]'--' =' 'ax plot(bounds[ ]'--' =' 'ax text(bounds[ ] two clusters'va='center'fontdict={'size' }ax text(bounds[ ] three clusters'va='center'fontdict={'size' }plt xlabel("... |
17,180 | rithm two clusters get merged the length of each branch also shows how far apart the merged clusters are the longest branches in this dendrogram are the three lines that are marked by the dashed line labeled "three clusters that these are the longest branches indicates that going from three to two clusters meant mergin... |
17,181 | eps of core points (called boundary points)and noise when the dbscan algorithm is run on particular dataset multiple timesthe clustering of the core points is always the sameand the same points will always be labeled as noise howevera boundary point might be neighbor to core samples of more than one cluster thereforeth... |
17,182 | min_samples and eps parameters in this plotpoints that belong to clusters are solidwhile the noise points are shown in white core samples are shown as large markerswhile boundary points are displayed as smaller markers increasing eps (going from left to right in the figuremeans that more points will be included in clus... |
17,183 | smaller clusters (with three and four pointsare now labeled as noiseand only the cluster with five samples remains while dbscan doesn' require setting the number of clusters explicitlysetting eps implicitly controls how many clusters will be found finding good setting for eps is sometimes easier after scaling the data ... |
17,184 | comparing and evaluating clustering algorithms one of the challenges in applying clustering algorithms is that it is very hard to assess how well an algorithm workedand to compare outcomes between different algorithms after talking about the algorithms behind -meansagglomerative clusteringand dbscanwe will now compare ... |
17,185 | from sklearn metrics cluster import adjusted_rand_score xy make_moons(n_samples= noise= random_state= rescale the data to zero mean and unit variance scaler standardscaler(scaler fit(xx_scaled scaler transform(xfigaxes plt subplots( figsize=( )subplot_kw={'xticks'()'yticks'()}make list of algorithms to use algorithms [... |
17,186 | instead of adjusted_rand_scorenormalized_mutual_info_scoreor some other clustering metric the problem in using accuracy is that it requires the assigned cluster labels to exactly match the ground truth howeverthe cluster labels themselves are meaningless--the only thing that matters is which points are in the same clus... |
17,187 | subplot_kw={'xticks'()'yticks'()}create random cluster assignment for reference random_state np random randomstate(seed= random_clusters random_state randint(low= high= size=len( )plot random assignment axes[ scatter(x_scaled[: ]x_scaled[: ] =random_clusterscmap=mglearn cm = axes[ set_title("random assignment{ }formats... |
17,188 | face images we hope to find groups of similar faces--saymen and womenor old people and young peopleor people with beards and without let' say we cluster the data into two clustersand all algorithms agree about which points should be clustered together we still don' know if the clusters that are found correspond in any ... |
17,189 | dbscan dbscan(min_samples= labels dbscan fit_predict(x_pcaprint("unique labels{}format(np unique(labels))out[ ]unique labels[- even when considering groups of three pointseverything is labeled as noise sowe need to increase epsin[ ]dbscan dbscan(min_samples= eps= labels dbscan fit_predict(x_pcaprint("unique labels{}for... |
17,190 | comparing these images to the random sample of face images from figure - we can guess why they were labeled as noisethe fifth image in the first row shows person drinking from glassthere are images of people wearing hatsand in the last image there' hand in front of the person' face the other images contain odd angles o... |
17,191 | clusters present[- cluster sizes[ eps= clusters present[- cluster sizes[ eps= clusters present[- cluster sizes[ eps= clusters present[- cluster sizes eps= clusters present[- cluster sizes for low settings of epsall points are labeled as noise for eps= we get many noise points and many smaller clusters for eps= we still... |
17,192 | some of the clusters correspond to people with very distinct faces (within this dataset)such as sharon or koizumi within each clusterthe orientation of the face is also clustering |
17,193 | tiple peoplebut they share similar orientation and expression this concludes our analysis of the dbscan algorithm applied to the faces dataset as you can seewe are doing manual analysis heredifferent from the much more automatic search approach we could use for supervised learning based on score or accuracy let' move o... |
17,194 | the cluster centers found by -means are very smooth versions of faces this is not very surprisinggiven that each center is an average of to face images working with reduced pca representation adds to the smoothness of the images (compared to the faces reconstructed using pca dimensions in figure - the clustering seems ... |
17,195 | on the leftfollowed by the five closest points to each center and the five points that are assigned to the cluster but are furthest away from the center unsupervised learning and preprocessing |
17,196 | the importance of orientation for the other clusters the "atypicalpoints are not very similar to the cluster centersthoughand their assignment seems somewhat arbitrary this can be attributed to the fact that -means partitions all the data points and doesn' have concept of "noisepointsas dbscan does using larger number ... |
17,197 | linkage_array ward(x_pcanow we plot the dendrogram for the linkage_array containing the distances between clusters plt figure(figsize=( )dendrogram(linkage_arrayp= truncate_mode='level'no_labels=trueplt xlabel("sample index"plt ylabel("cluster distance"figure - dendrogram of agglomerative clustering on the faces datase... |
17,198 | sponds to one clusterthe number to the left lists the number of images in each cluster clustering |
17,199 | large to be actually homogeneous to get more homogeneous clusterswe can run the algorithm againthis time with clustersand pick out some of the clusters that are particularly interesting (figure - )in[ ]extract clusters with ward agglomerative clustering agglomerative agglomerativeclustering(n_clusters= labels_agg agglo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.