úÎ4‰0×@      !"#$%&'()*+,-./0123456789:;<=>?None$O(1) Return the size of a dendrogram compute distance matrix #compute distance matrix in parallel   (c) 2015 Kai ZhangMITkai@kzhang.org experimentalportableNone Š nearest neighbor chain algorithm^all update functions perform destructive updates, and hence should not be called by end userssingle linkage update formulacomplete linkage update formulaaverage linkage update formulaweighted linkage update formulaward linkage update formula@distance matrixquery;this would be selected if it achieves the minimal distance(c) 2015 Kai ZhangMITkai@kzhang.org experimentalportableNone<s*Different hierarchical clustering schemes.>O(n^2) Single linkage, $d(A,B) = min_{a in A, b in B} d(a,b)$.@O(n^2) Complete linkage, $d(A,B) = max_{a in A, b in B} d(a,b)$.YO(n^2) Average linkage or UPGMA, $d(A,B) = frac{sum_{a in A}sum_{b in B}d(a,b)}{|A||B|}$.O(n^2) Weighted linkage.O(n^2) Ward's method.)O(n^3) Centroid linkage, not implemented.'O(n^3) Median linkage, not implemented.  Perform hierarchical clustering.!4Normalize the tree heights so that the highest is 1."!Cut a dendrogram at given height.#1Return the elements of a dendrogram in pre-order.$%2-dimensional drawing of a dendrogram%.Compute euclidean distance between two points.&Hamming distance. !"#$%& !"#$%&None<îARGenerate N non-duplicated uniformly distributed random variables in a given range.'The number of clusters Input dataFeature extraction function(The number of clusters Input dataFeature extraction function'()'()(c) 2015 Kai ZhangMITkai@kzhang.org experimentalportableNone(Û * Different initialization methods+pThe Forgy method randomly chooses k unique observations from the data set and uses these as the initial means.,K-means++ algorithm.-Provide a set of k centroids.Results from running kmeans0YA vector of integers (0 ~ k-1) indicating the cluster to which each point is allocated.1A matrix of cluster centers.3the sum of squared error (SSE)7!Seed for random number generation8/Wether to return clusters, may use a lot memory9Maximum iteration:ÈDefault options. > defaultKMeansOpts = KMeansOpts > { kmeansMethod = KMeansPP > , kmeansSeed = U.fromList [1,2,3,4,5,6,7] > , kmeansClusters = True > , kmeansMaxIter = 10 > }*,+-./1023456789:456789:./0123*+,-*+,-./0123456789None</i<Perform K-means clustering=?Perform K-means clustering, using a feature extraction functionBK-means algorithm>.Assign data to clusters based on KMeans result<The number of clusters%Input data stored as rows in a matrix=The number of clusters Input dataBInitial set of k centroids Max inter Input dataFeature extraction function*,+-./1023456789:<=>./0123456789:<=*+,->None<0É?rearrange the rows of a matrix??C      !"#$%&'()*+,-./01234556789::;<=>?@ABCDEFGH'clustering-0.4.0-48j93kEumS6JErEYlYUZLC AI.Clustering.Hierarchical.Types#AI.Clustering.Hierarchical.InternalAI.Clustering.HierarchicalAI.Clustering.KMeans.InternalAI.Clustering.KMeans.TypesAI.Clustering.KMeansAI.Clustering.Utils DistanceMat DendrogramLeafBranchSizeDistFnDistancesize!idx computeDists computeDists'$fFunctorDendrogram$fBinaryDendrogram$fShowDendrogram$fEqDendrogram$fShowDistanceMatnnChainsinglecompleteaverageweightedwardLinkageSingleCompleteAverageWeightedWardCentroidMedianhclust normalizecutAtflattendrawDendrogram euclideanhammingforgykmeansPP sumSquaresMethodForgyKMeansPPCentersKMeans membershipcentersclusterssse KMeansOpts kmeansMethod kmeansSeedkmeansClusters kmeansMaxIterdefaultKMeansOpts $fShowKMeanskmeanskmeansBydecodeorderBynearestNeighbor uniformRNkmeans'