# doc-cache created by Octave 11.2.0
# name: cache
# type: cell
# rows: 3
# columns: 18
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 26
CalinskiHarabaszEvaluation


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 838
 -- statistics: CalinskiHarabaszEvaluation

     Calinski-Harabasz clustering evaluation.

     A ‘CalinskiHarabaszEvaluation’ object contains the results of evaluating
     clustering solutions using the Calinski-Harabasz criterion.

     The Calinski-Harabasz index (also known as the Variance Ratio Criterion) is
     determined by the ratio of the between-cluster sum of squares (SSB) to the
     within-cluster sum of squares (SSW). A higher Calinski-Harabasz index value
     indicates a better clustering solution, implying that clusters are dense
     and well-separated.

     Create a ‘CalinskiHarabaszEvaluation’ object by using the ‘evalclusters’
     function with the 'CalinskiHarabasz' criterion.

     See also: evalclusters, ClusterCriterion, DaviesBouldinEvaluation,
     GapEvaluation, SilhouetteEvaluation.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 40
Calinski-Harabasz clustering evaluation.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 16
ClusterCriterion


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 389
 -- statistics: ClusterCriterion

     A clustering evaluation object.

     The ‘ClusterCriterion’ is a superclass for clustering evaluation objects,
     which are created by the ‘evalclusters’ function.  It is not meant to be
     instantiated directly.

     See also: evalclusters, CalinskiHarabaszEvaluation,
     DaviesBouldinEvaluation, GapEvaluation, SilhouetteEvaluation.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 31
A clustering evaluation object.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 23
DaviesBouldinEvaluation


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 704
 -- statistics: DaviesBouldinEvaluation

     Davies-Bouldin object to evaluate clustering solutions

     A ‘DaviesBouldinEvaluation’ object is a ‘ClusterCriterion’ object used to
     evaluate clustering solutions using the Davies-Bouldin criterion.

     The Davies-Bouldin criterion is based on the ratio between the distances
     between clusters and within clusters, that is between centroids and between
     each datapoint and its centroid.

     The best solution according to the Davies-Bouldin criterion is the one that
     produces the lowest Davies-Bouldin value.

     See also: evalclusters, ClusterCriterion, CalinskiHarabaszEvaluation,
     GapEvaluation, SilhouetteEvaluation.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 54
Davies-Bouldin object to evaluate clustering solutions



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 13
GapEvaluation


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 729
 -- statistics: GapEvaluation

     Gap evaluation for clustering solutions

     The ‘GapEvaluation’ class implements the gap statistic criterion for
     evaluating clustering solutions.  A ‘GapEvaluation’ object is a
     specialization of ‘ClusterCriterion’ and contains fields and methods to
     compute the gap statistic, its Monte-Carlo reference expectations, and to
     select the optimal number of clusters according to a chosen search method.

     Create a ‘GapEvaluation’ object by using the ‘evalclusters’ function or by
     calling the class constructor directly.

     See also: evalclusters, ClusterCriterion, CalinskiHarabaszEvaluation,
     DaviesBouldinEvaluation, SilhouetteEvaluation.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 39
Gap evaluation for clustering solutions



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 20
SilhouetteEvaluation


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1488
 -- statistics: SilhouetteEvaluation

     Silhouette evaluation for clustering

     The ‘SilhouetteEvaluation’ class implements an object to evaluate
     clustering solutions using the silhouette criterion.  A
     ‘SilhouetteEvaluation’ object is a ‘ClusterCriterion’ object that computes
     silhouette values for clustering solutions and selects the best number of
     clusters as the one with the highest average silhouette value.

     Create a ‘SilhouetteEvaluation’ object by using the ‘evalclusters’ function
     or the class constructor.

     List of public properties specific to ‘SilhouetteEvaluation’:
     ‘Distance’
          A valid distance metric name (string), a function handle, or a numeric
          vector as returned by ‘pdist’.  This specifies how pairwise distances
          are computed.

     ‘ClusterPriors’
          A character vector specifying how to evaluate silhouette values across
          clusters: 'empirical' (default) uses empirical cluster priors, or
          'equal' treats clusters equally.

     ‘ClusterSilhouettes’
          A cell array containing silhouette values for each observation for
          each inspected cluster number.

     The best clustering solution according to the silhouette criterion is the
     one that yields the highest average silhouette value.

     See also: evalclusters, ClusterCriterion, CalinskiHarabaszEvaluation,
     DaviesBouldinEvaluation, GapEvaluation.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 36
Silhouette evaluation for clustering



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 7
cluster


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1214
 -- statistics: T = cluster (Z, "Cutoff", C)
 -- statistics: T = cluster (Z, "Cutoff", C, "Depth", D)
 -- statistics: T = cluster (Z, "Cutoff", C, "Criterion", CRITERION)
 -- statistics: T = cluster (Z, "MaxClust", N)

     Define clusters from an agglomerative hierarchical cluster tree.

     Given a hierarchical cluster tree Z generated by the ‘linkage’ function,
     ‘cluster’ defines clusters, using a threshold value C to identify new
     clusters ('Cutoff') or according to a maximum number of desired clusters N
     ('MaxClust').

     CRITERION is used to choose the criterion for defining clusters, which can
     be either "inconsistent" (default) or "distance".  When using
     "inconsistent", ‘cluster’ compares the threshold value C to the
     inconsistency coefficient of each link; when using "distance", ‘cluster’
     compares the threshold value C to the height of each link.  D is the depth
     used to evaluate the inconsistency coefficient, its default value is 2.

     ‘cluster’ uses "distance" as a criterion for defining new clusters when it
     is used with the 'MaxClust' method.

     See also: clusterdata, dendrogram, inconsistent, kmeans, linkage, pdist.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 64
Define clusters from an agglomerative hierarchical cluster tree.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 11
clusterdata


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 868
 -- statistics: T = clusterdata (X, CUTOFF)
 -- statistics: T = clusterdata (X, NAME, VALUE)

     Wrapper function for ‘linkage’ and ‘cluster’.

     If CUTOFF is used, then ‘clusterdata’ calls ‘linkage’ and ‘cluster’ with
     default value, using CUTOFF as a threshold value for ‘cluster’.  If CUTOFF
     is an integer and greater or equal to 2, then CUTOFF is interpreted as the
     maximum number of cluster desired and the "MaxClust" option is used for
     ‘cluster’.

     If CUTOFF is not used, then ‘clusterdata’ expects a list of pair arguments.
     Then you must specify either the "Cutoff" or "MaxClust" option for
     ‘cluster’.  The method and metric used by ‘linkage’, are defined through
     the "linkage" and "distance" arguments.

     See also: cluster, dendrogram, inconsistent, kmeans, linkage, pdist.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 61
Wrapper function for ‘linkage’ and ‘cluster’.

   If 



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 8
cophenet


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1099
 -- statistics: [C, D] = cophenet (Z, Y)

     Compute the cophenetic correlation coefficient.

     The cophenetic correlation coefficient C of a hierarchical cluster tree Z
     is the linear correlation coefficient between the cophenetic distances D
     and the euclidean distances Y.

     It is a measure of the similarity between the distance of the leaves, as
     seen in the tree, and the distance of the original data points, which were
     used to build the tree.  When this similarity is greater, that is the
     coefficient is closer to 1, the tree renders an accurate representation of
     the distances between the original data points.

     Z is a hierarchical cluster tree, as the output of ‘linkage’.  Y is a
     vector of euclidean distances, as the output of ‘pdist’.

     The optional output D is a vector of cophenetic distances, in the same
     lower triangular format as Y.  The cophenetic distance between two data
     points is the height of the lowest common node of the tree.

     See also: cluster, dendrogram, inconsistent, linkage, pdist, squareform.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 47
Compute the cophenetic correlation coefficient.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 6
dbscan


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 3553
 -- statistics: IDX = dbscan (X, EPSILON, MINPTS)
 -- statistics: IDX = dbscan (D, EPSILON, MINPTS, 'Distance', 'precomputed')
 -- statistics: IDX = dbscan (..., NAME, VALUE)
 -- statistics: [IDX, COREPTS] = dbscan (...)

     Density-Based Spatial Clustering of Applications with Noise (DBSCAN).

     ‘IDX = dbscan (X, EPSILON, MINPTS)’ partitions the observations in the N*P
     numeric matrix X into clusters using the DBSCAN algorithm with neighborhood
     radius EPSILON and minimum number of neighbors MINPTS.  Rows of X
     correspond to observations and columns correspond to features or variables.
     EPSILON must be a nonnegative scalar and MINPTS a positive integer scalar.
     IDX is an N*1 vector of cluster indices, numbered 1 to the number of
     clusters found; observations flagged as noise are assigned the value -1.

     A point is a _core point_ when at least MINPTS observations (*including the
     point itself*) lie within distance EPSILON of it.  Clusters grow from core
     points to every observation that is density-reachable from them; a non-core
     observation that lies within EPSILON of a core point becomes a _border
     point_ and joins that point's cluster, while an observation that is neither
     core nor within reach of a core point is labelled noise.  A border point
     that is reachable from more than one cluster is assigned to the first
     cluster that reaches it, following the order of the observations in X.

     ‘IDX = dbscan (D, EPSILON, MINPTS, 'Distance', 'precomputed')’ treats the
     N*N matrix D as a precomputed matrix of pairwise distances between
     observations, such as the output of ‘pdist2’; D(i,j) is the distance
     between observations i and j.

     ‘[IDX, COREPTS] = dbscan (...)’ also returns an N*1 logical vector COREPTS
     that is true for each observation that is a core point.

     Additional parameters can be specified by Name-Value pair arguments.

     NAME           VALUE
                    
     --------------------------------------------------------------------------------
     'Distance'     is the distance metric used to find neighbors, specified as
                    one of the metrics accepted by ‘rangesearch’ ('euclidean' by
                    default, and also 'seuclidean', 'cityblock', 'chebychev',
                    'minkowski', 'mahalanobis', 'cosine', 'correlation',
                    'spearman', 'hamming', 'jaccard', or a custom distance
                    function handle), or the string 'precomputed' to interpret the
                    first input as a matrix of pairwise distances.
                    
     'P'            is the Minkowski distance exponent, a positive scalar.  This
                    argument is only valid when the selected distance metric is
                    'minkowski'.  By default it is 2.
                    
     'Scale'        is the scale parameter for the standardized Euclidean
                    distance, a nonnegative numeric vector of length equal to the
                    number of columns in X.  This argument is only valid when the
                    selected distance metric is 'seuclidean'.
                    
     'Cov'          is the covariance matrix for the mahalanobis distance, a
                    positive definite matrix matching the number of columns in X.
                    This argument is only valid when the selected distance metric
                    is 'mahalanobis'.

     See also: kmeans, rangesearch, pdist2, knnsearch.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 69
Density-Based Spatial Clustering of Applications with Noise (DBSCAN).



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 12
evalclusters


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 4768
 -- statistics: EVA = evalclusters (X, CLUST, CRITERION)
 -- statistics: EVA = evalclusters (..., Name, Value)

     Create a clustering evaluation object to find the optimal number of
     clusters.

     ‘evalclusters’ creates a clustering evaluation object to evaluate the
     optimal number of clusters for data X, using criterion CRITERION.  The
     input data X is a matrix with ‘n’ observations of ‘p’ variables.  The
     evaluation criterion CRITERION is one of the following:
     ‘CalinskiHarabasz’
          to create a ‘CalinskiHarabaszEvaluation’ object.

     ‘DaviesBouldin’
          to create a ‘DaviesBouldinEvaluation’ object.

     ‘gap’
          to create a ‘GapEvaluation’ object.

     ‘silhouette’
          to create a ‘SilhouetteEvaluation’ object.

     The clustering algorithm CLUST is one of the following:
     ‘kmeans’
          to cluster the data using ‘kmeans’ with ‘EmptyAction’ set to
          ‘singleton’ and ‘Replicates’ set to 5.

     ‘linkage’
          to cluster the data using ‘clusterdata’ with ‘linkage’ set to ‘Ward’.

     ‘gmdistribution’
          to cluster the data using ‘fitgmdist’ with ‘SharedCov’ set to ‘true’
          and ‘Replicates’ set to 5.

     If the CRITERION is ‘CalinskiHarabasz’, ‘DaviesBouldin’, or ‘silhouette’,
     CLUST can also be a function handle to a function of the form ‘c = clust(x,
     k)’, where X is the input data, K the number of clusters to evaluate and C
     the clustering result.  The clustering result can be either an array of
     size ‘n’ with ‘k’ different integer values, or a matrix of size ‘n’ by ‘k’
     with a likelihood value assigned to each one of the ‘n’ observations for
     each one of the K clusters.  In the latter case, each observation is
     assigned to the cluster with the higher value.  If the CRITERION is
     ‘CalinskiHarabasz’, ‘DaviesBouldin’, or ‘silhouette’, CLUST can also be a
     matrix of size ‘n’ by ‘k’, where ‘k’ is the number of proposed clustering
     solutions, so that each column of CLUST is a clustering solution.

     In addition to the obligatory X, CLUST and CRITERION inputs there is a
     number of optional arguments, specified as pairs of ‘Name’ and ‘Value’
     options.  The known ‘Name’ arguments are:
     ‘KList’
          a vector of positive integer numbers, that is the cluster sizes to
          evaluate.  This option is necessary, unless CLUST is a matrix of
          proposed clustering solutions.

     ‘Distance’
          a distance metric as accepted by the chosen CLUST.  It can be the name
          of the distance metric as a string or a function handle.  When
          CRITERION is ‘silhouette’, it can be a vector as created by function
          ‘pdist’.  Valid distance metric strings are: ‘sqEuclidean’ (default),
          ‘Euclidean’, ‘cityblock’, ‘cosine’, ‘correlation’, ‘Hamming’,
          ‘Jaccard’.  Only used by ‘silhouette’ and ‘gap’ evaluation.

     ‘ClusterPriors’
          the prior probabilities of each cluster, which can be either
          ‘empirical’ (default), or ‘equal’.  When ‘empirical’ the silhouette
          value is the average of the silhouette values of all points; when
          ‘equal’ the silhouette value is the average of the average silhouette
          value of each cluster.  Only used by ‘silhouette’ evaluation.

     ‘B’
          the number of reference datasets generated from the reference
          distribution.  Only used by ‘gap’ evaluation.

     ‘ReferenceDistribution’
          the reference distribution used to create the reference data.  It can
          be ‘PCA’ (default) for a distribution based on the principal
          components of X, or ‘uniform’ for a uniform distribution based on the
          range of the observed data.  ‘PCA’ is currently not implemented.  Only
          used by ‘gap’ evaluation.

     ‘SearchMethod’
          the method for selecting the optimal value with a ‘gap’ evaluation.
          It can be either ‘globalMaxSE’ (default) for selecting the smallest
          number of clusters which is inside the standard error of the maximum
          gap value, or ‘firstMaxSE’ for selecting the first number of clusters
          which is inside the standard error of the following cluster number.
          Only used by ‘gap’ evaluation.

     Output EVA is a clustering evaluation object.

     See also: CalinskiHarabaszEvaluation, DaviesBouldinEvaluation,
     GapEvaluation, SilhouetteEvaluation.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 77
Create a clustering evaluation object to find the optimal number of clusters.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 9
fitgmdist


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 2994
 -- statistics: GMDIST = fitgmdist (DATA, K, PARAM1, VALUE1, ...)

     Fit a Gaussian mixture model with K components to DATA.  Each row of DATA
     is a data sample.  Each column is a variable.

     Optional parameters are:
        • 'start': Initialization conditions.  Possible values are:
             • 'randSample' (default) Takes means uniformly from rows of data.
             • 'plus' Use k-means++ to initialize means.
             • 'cluster' Performs an initial clustering with 10% of the data.
             • VECTOR A vector whose length is the number of rows in data, and
               whose values are 1 to k specify the components each row is
               initially allocated to.  The mean, variance, and weight of each
               component is calculated from that.
             • STRUCTURE A structure with fields mu, Sigma and
               ComponentProportion.
          For 'randSample', 'plus', and 'cluster', the initial variance of each
          component is the variance of the entire data sample.

        • 'Replicates': Number of random restarts to perform.

        • 'RegularizationValue' or 'Regularize': A small number added to the
          diagonal entries of the covariance to prevent singular covariances.

        • 'SharedCovariance' or 'SharedCov' (logical).  True if all components
          must share the same variance, to reduce the number of free parameters

        • 'CovarianceType' or 'CovType' (string).  Possible values are:
             • 'full' (default) Allow arbitrary covariance matrices.
             • 'diagonal' Force covariances to be diagonal, to reduce the number
               of free parameters.

        • 'Options': A structure with all of the following fields:
             • MaxIter Maximum number of EM iterations (default 100).
             • TolFun Threshold increase in likelihood to terminate EM (default
               1e-6).
             • Display Possible values are:
                  • 'off' (default): Display nothing.
                  • 'final': Display the total number of iterations and
                    likelihood once the execution completes.
                  • 'iter': Display the number of iteration and likelihood after
                    each iteration.
        • 'Weight': A column vector or N*2 matrix.  The first column consists of
          non-negative weights given to the samples.  If these are all integers,
          this is equivalent to specifying WEIGHT(i) copies of row i of DATA,
          but potentially faster.  If a row of DATA is used to represent samples
          that are similar but not identical, then the second column of WEIGHT
          indicates the variance of those original samples.  Specifically, in
          the EM algorithm, the contribution of row i towards the variance is
          set to at least WEIGHT(i,2), to prevent spurious components with zero
          variance.

     See also: gmdistribution, kmeans.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 55
Fit a Gaussian mixture model with K components to DATA.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 14
gmdistribution


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1185
 -- statistics: GMDIST = gmdistribution (MU, SIGMA)
 -- statistics: GMDIST = gmdistribution (MU, SIGMA, P)
 -- statistics: GMDIST = gmdistribution (MU, SIGMA, P, EXTRA)

     Create an object of the gmdistribution class which represents a Gaussian
     mixture model with k components of n-dimensional Gaussians.

     Input MU is a k-by-n matrix specifying the n-dimensional mean of each of
     the k components of the distribution.

     Input SIGMA is an array that specifies the variances of the distributions,
     in one of four forms depending on its dimension.
        • n-by-n-by-k: Slice SIGMA(:,:,i) is the variance of the i'th component
        • 1-by-n-by-k: Slice diag(SIGMA(1,:,i)) is the variance of the i'th
          component
        • n-by-n: SIGMA is the variance of every component
        • 1-by-n-by-k: Slice diag(SIGMA) is the variance of every component

     If P is specified, it is a vector of length k specifying the proportion of
     each component.  If it is omitted or empty, each component has an equal
     proportion.

     Input EXTRA is used by fitgmdist to indicate the parameters of the fitting
     process.

     See also: fitgmdist.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80
Create an object of the gmdistribution class which represents a Gaussian mixt...



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 12
inconsistent


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1044
 -- statistics: Y = inconsistent (Z)
 -- statistics: Y = inconsistent (Z, D)

     Compute the inconsistency coefficient for each link of a hierarchical
     cluster tree.

     Given a hierarchical cluster tree Z generated by the ‘linkage’ function,
     ‘inconsistent’ computes the inconsistency coefficient for each link of the
     tree, using all the links down to the D-th level below that link.

     The default depth D is 2, which means that only two levels are considered:
     the level of the computed link and the level below that.

     Each row of Y corresponds to the row of same index of Z.  The columns of Y
     are respectively: the mean of the heights of the links used for the
     calculation, the standard deviation of the heights of those links, the
     number of links used, the inconsistency coefficient.

     *Reference* Jain, A., and R. Dubes.  Algorithms for Clustering Data.  Upper
     Saddle River, NJ: Prentice-Hall, 1988.

     See also: cluster, clusterdata, dendrogram, linkage, pdist, squareform.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80
Compute the inconsistency coefficient for each link of a hierarchical cluster...



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 6
kmeans


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 6671
 -- statistics: IDX = kmeans (DATA, K)
 -- statistics: [IDX, CENTERS] = kmeans (DATA, K)
 -- statistics: [IDX, CENTERS, SUMD] = kmeans (DATA, K)
 -- statistics: [IDX, CENTERS, SUMD, DIST] = kmeans (DATA, K)
 -- statistics: [...] = kmeans (DATA, K, PARAM1, VALUE1, ...)
 -- statistics: [...] = kmeans (DATA, [], 'start', START, ...)

     Perform a K-means clustering of the N*D matrix DATA.

     If parameter 'start' is specified, then K may be empty in which case K is
     set to the number of rows of START.

     The outputs are:

     IDX          An N*1 vector whose i-th element is the class to which row i
                  of DATA is assigned.
                  
     CENTERS      A K*D array whose i-th row is the centroid of cluster i.
                  
     SUMD         A k*1 vector whose i-th entry is the sum of the distances from
                  samples in cluster i to centroid i.
                  
     DIST         An N*k matrix whose ij-th element is the distance from sample
                  i to centroid j.

     The following parameters may be placed in any order.  Each parameter must
     be followed by its value, as in Name-Value pairs.

     Name         Description
     --------------------------------------------------------------------------------
     'Start'      The initialization method for the centroids.

     Value           Description
     -----------------------------------------------------------------------------
     'plus'          The k-means++ algorithm.  (Default)
     'sample'        A subset of k rows from DATA, sampled uniformly without
                     replacement.
     'cluster'       Perform a pilot clustering on 10% of the rows of DATA.
     'uniform'       Each component of each centroid is drawn uniformly from
                     the interval between the maximum and minimum values of
                     that component within DATA.  This performs poorly and is
                     implemented only for Matlab compatibility.
     NUMERIC         A k*D matrix of centroid starting locations.  The rows
     MATRIX          correspond to seeds.
     NUMERIC ARRAY   A k*D*r array of centroid starting locations.  The third
                     dimension invokes replication of the clustering routine.
                     Page r contains the set of seeds for replicate r.  kmeans
                     infers the number of replicates (specified by the
                     'Replicates' Name-Value pair argument) from the size of
                     the third dimension.

     Name         Description
     ---------------------------------------------------------------------------------
     'Distance'   The distance measure used for partitioning and calculating
                  centroids.

     Value           Description
     -----------------------------------------------------------------------------
     'sqeuclidean'   The squared Euclidean distance.  i.e.  the sum of the
                     squares of the differences between corresponding
                     components.  In this case, the centroid is the arithmetic
                     mean of all samples in its cluster.  This is the only
                     distance for which this algorithm is truly "k-means".
     'cityblock'     The sum metric, or L1 distance, i.e.  the sum of the
                     absolute differences between corresponding components.  In
                     this case, the centroid is the median of all samples in
                     its cluster.  This gives the k-medians algorithm.
     'cosine'        One minus the cosine of the included angle between points
                     (treated as vectors).  Each centroid is the mean of the
                     points in that cluster, after normalizing those points to
                     unit Euclidean length.
     'correlation'   One minus the sample correlation between points (treated
                     as sequences of values).  Each centroid is the
                     component-wise mean of the points in that cluster, after
                     centering and normalizing those points to zero mean and
                     unit standard deviation.
     'hamming'       The number of components in which the sample and the
                     centroid differ.  In this case, the centroid is the median
                     of all samples in its cluster.  Unlike Matlab, Octave
                     allows non-logical DATA.

     Name         Description
     ---------------------------------------------------------------------------------
     'EmptyAction'What to do when a centroid is not the closest to any data sample.

     Value           Description
     -----------------------------------------------------------------------------
     'error'         Throw an error.
     'singleton'     (Default) Select the row of DATA that has the highest
                     error and use that as the new centroid.
     'drop'          Remove the centroid, and continue computation with one
                     fewer centroid.  The dimensions of the outputs CENTROIDS
                     and D are unchanged, with values for omitted centroids
                     replaced by NaN.

     Name         Description
     ---------------------------------------------------------------------------------
     'Display'    Display a text summary.

     Value           Description
     -----------------------------------------------------------------------------
     'off'           (Default) Display no summary.
     'final'         Display a summary for each clustering operation.
     'iter'          Display a summary for each iteration of a clustering
                     operation.

     Name         Value
     ---------------------------------------------------------------------------------
     'Replicates' A positive integer specifying the number of independent
                  clusterings to perform.  The output values are the values for the
                  best clustering, i.e., the one with the smallest value of SUMD.
                  If START is numeric, then REPLICATES defaults to (and must equal)
                  the size of the third dimension of START.  Otherwise it defaults
                  to 1.
     'MaxIter'    The maximum number of iterations to perform for each replicate.
                  If the maximum change of any centroid is less than 0.001, then
                  the replicate terminates even if MAXITER iterations have no
                  occurred.  The default is 100.

     Example:

     [~,c] = kmeans (rand(10, 3), 2, "emptyaction", "singleton");

     See also: linkage.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 52
Perform a K-means clustering of the N*D matrix DATA.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 8
kmedoids


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 3785
 -- statistics: IDX = kmedoids (X, K)
 -- statistics: [IDX, C] = kmedoids (X, K)
 -- statistics: [IDX, C, SUMD] = kmedoids (X, K)
 -- statistics: [IDX, C, SUMD, D] = kmedoids (X, K)
 -- statistics: [IDX, C, SUMD, D, MIDX] = kmedoids (X, K)
 -- statistics: [IDX, C, SUMD, D, MIDX, INFO] = kmedoids (X, K)
 -- statistics: [...] = kmedoids (..., NAME, VALUE)

     Partition observations into K clusters using the k-medoids algorithm.

     ‘IDX = kmedoids (X, K)’ partitions the N*P numeric matrix X into K
     clusters, each represented by one of the observations (its _medoid_), and
     returns the N*1 vector IDX of cluster indices.  Rows of X correspond to
     observations and columns correspond to features or variables.  Unlike
     ‘kmeans’, whose centroids are the mean of each cluster, a medoid is an
     actual data point, which makes k-medoids more robust to outliers and
     applicable to any distance metric.

     ‘[IDX, C, SUMD, D, MIDX, INFO] = kmedoids (...)’ returns additional
     results:

     C              a k*P matrix with the coordinates of the K medoids, one per
                    row (‘C = X(MIDX,:)’).
                    
     SUMD           a k*1 vector with the within-cluster sum of the distances from
                    each point to its cluster medoid, measured with the selected
                    metric.
                    
     D              an N*k matrix with the distance from every observation to
                    every medoid.
                    
     MIDX           a k*1 vector with the row indices into X of the K medoids.
                    
     INFO           a scalar structure with the fields 'algorithm', 'start',
                    'distance', 'iterations', and 'bestReplicate' describing the
                    chosen run.

     Additional parameters can be specified by Name-Value pair arguments.

     NAME           VALUE
                    
     --------------------------------------------------------------------------------
     'Distance'     the distance metric, one of 'sqeuclidean' (default),
                    'euclidean', 'seuclidean', 'cityblock', 'minkowski',
                    'chebychev', 'cosine', 'correlation', 'hamming', 'jaccard',
                    'spearman', 'mahalanobis', or a custom distance function
                    handle accepted by ‘pdist2’.
                    
     'Algorithm'    the optimization algorithm, either 'pam' (default) for
                    Partitioning Around Medoids, which searches over all
                    medoid/non-medoid swaps, or 'small' for the faster Voronoi
                    iteration that reassigns points and re-selects each cluster
                    medoid until convergence.
                    
     'Start'        the method used to choose the initial medoids: 'plus'
                    (default, k-means++), 'sample' (a random subset of the
                    observations), 'cluster' (a preliminary pass on a subsample),
                    or a k*P numeric matrix of starting medoid locations, each
                    snapped to the nearest observation.  A k*P*R array supplies a
                    separate start for each of R replicates.
                    
     'Replicates'   a positive integer number of times to repeat the clustering,
                    each with a new set of initial medoids; the solution with the
                    lowest total sum of distances is returned.  The default is 1,
                    or the size of the third dimension of a numeric 'Start'.
                    
     'Options'      a structure, as created by ‘statset’, whose 'MaxIter' field
                    caps the number of iterations (default 100).

     See also: kmeans, linkage, pdist2, dbscan.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 69
Partition observations into K clusters using the k-medoids algorithm.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 7
linkage


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 3630
 -- statistics: Y = linkage (D)
 -- statistics: Y = linkage (D, METHOD)
 -- statistics: Y = linkage (X)
 -- statistics: Y = linkage (X, METHOD)
 -- statistics: Y = linkage (X, METHOD, METRIC)
 -- statistics: Y = linkage (X, METHOD, ARGLIST)

     Produce a hierarchical clustering dendrogram.

     D is the dissimilarity matrix relative to n observations, formatted as a
     (n-1)*n/2x1 vector as produced by ‘pdist’.  Alternatively, X contains data
     formatted for input to ‘pdist’, METRIC is a metric for ‘pdist’ and ARGLIST
     is a cell array containing arguments that are passed to ‘pdist’.

     ‘linkage’ starts by putting each observation into a singleton cluster and
     numbering those from 1 to n.  Then it merges two clusters, chosen according
     to METHOD, to create a new cluster numbered n+1, and so on until all
     observations are grouped into a single cluster numbered 2(n-1).  Row k of
     the (m-1)x3 output matrix relates to cluster n+k: the first two columns are
     the numbers of the two component clusters and column 3 contains their
     distance.

     When several pairs of clusters are equally close, which of them is merged
     first is not determined by the data, and the cluster numbers in the first
     two columns are therefore implementation-defined.  Only column 3, the
     sequence of merge distances, is reproducible across implementations, and
     even that is so only for the methods whose recomputation rule does not
     depend on the merge order ("weighted", "centroid" and "median" do depend on
     it).  Code that must be portable should read column 3, or the cluster
     assignment obtained from ‘cluster’, rather than the raw numbering.

     METHOD defines the way the distance between two clusters is computed and
     how they are recomputed when two clusters are merged:

     ‘"single" (default)’
          Distance between two clusters is the minimum distance between two
          elements belonging each to one cluster.  Produces a cluster tree known
          as minimum spanning tree.

     ‘"complete"’
          Furthest distance between two elements belonging each to one cluster.

     ‘"average"’
          Unweighted pair group method with averaging (UPGMA). The mean distance
          between all pair of elements each belonging to one cluster.

     ‘"weighted"’
          Weighted pair group method with averaging (WPGMA). When two clusters A
          and B are joined together, the new distance to a cluster C is the mean
          between distances A-C and B-C.

     ‘"centroid"’
          Unweighted Pair-Group Method using Centroids (UPGMC). Assumes
          Euclidean metric.  The distance between cluster centroids, each
          centroid being the center of mass of a cluster.

     ‘"median"’
          Weighted pair-group method using centroids (WPGMC). Assumes Euclidean
          metric.  Distance between cluster centroids.  When two clusters are
          joined together, the new centroid is the midpoint between the joined
          centroids.

     ‘"ward"’
          Ward's sum of squared deviations about the group mean (ESS). Also
          known as minimum variance or inner squared distance.  Assumes
          Euclidean metric.  How much the moment of inertia of the merged
          cluster exceeds the sum of those of the individual clusters.

     *Reference* Ward, J. H. Hierarchical Grouping to Optimize an Objective
     Function J. Am.  Statist.  Assoc.  1963, 58, 236-244,
     <http://iv.slis.indiana.edu/sw/data/ward.pdf>.

     See also: pdist,squareform.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 45
Produce a hierarchical clustering dendrogram.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 16
optimalleaforder


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1312
 -- statistics: LEAFORDER = optimalleaforder (TREE, D)
 -- statistics: LEAFORDER = optimalleaforder (..., NAME, VALUE)

     Compute the optimal leaf ordering of a hierarchical binary cluster tree.

     The optimal leaf ordering of a tree is the ordering which minimizes the sum
     of the distances between each leaf and its adjacent leaves, without
     altering the structure of the tree, that is without redefining the clusters
     of the tree.

     Required inputs:
        • TREE: a hierarchical cluster tree TREE generated by the ‘linkage’
          function.

        • D: a matrix of distances as computed by ‘pdist’.

     Optional inputs can be the following property/value pairs:
        • property 'Criteria' at the moment can only have the value 'adjacent',
          for minimizing the distances between leaves.

        • property 'Transformation' can have one of the values 'linear',
          'inverse' or a handle to a custom function which computes S the
          similarity matrix.

     optimalleaforder's output LEAFORDER is the optimal leaf ordering.

     *Reference* Bar-Joseph, Z., Gifford, D.K., and Jaakkola, T.S. Fast optimal
     leaf ordering for hierarchical clustering.  Bioinformatics vol.  17 suppl.
     1, 2001.

     See also: dendrogram,linkage,pdist.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 72
Compute the optimal leaf ordering of a hierarchical binary cluster tree.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 15
spectralcluster


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 3838
 -- statistics: IDX = spectralcluster (X, K)
 -- statistics: IDX = spectralcluster (S, K, 'Distance', 'precomputed')
 -- statistics: [IDX, V] = spectralcluster (...)
 -- statistics: [IDX, V, D] = spectralcluster (...)
 -- statistics: [...] = spectralcluster (..., NAME, VALUE)

     Partition observations into K clusters using spectral clustering.

     ‘IDX = spectralcluster (X, K)’ partitions the N*P numeric matrix X into K
     clusters and returns the N*1 vector IDX of cluster indices.  Rows of X
     correspond to observations and columns to features.  Spectral clustering
     builds a similarity graph over the observations, embeds them with the
     eigenvectors of the graph Laplacian, and clusters that embedding, which
     lets it recover clusters that are not linearly separable in the original
     space.

     ‘[IDX, V, D] = spectralcluster (...)’ also returns the N*k matrix V whose
     columns are the eigenvectors associated with the K smallest eigenvalues of
     the Laplacian, and the k*1 vector D of those eigenvalues.  The signs of the
     eigenvectors, and the basis within a repeated eigenvalue, are arbitrary.

     Additional parameters can be specified by Name-Value pair arguments.

     NAME               VALUE
                        
     ---------------------------------------------------------------------------------
     'Distance'         the distance metric used to build the similarity graph, one
                        of 'euclidean' (default), 'seuclidean', 'mahalanobis',
                        'cityblock', 'minkowski', 'chebychev', 'cosine',
                        'correlation', 'hamming', 'jaccard', 'spearman', or a
                        function handle accepted by ‘pdist2’, or the string
                        'precomputed' to interpret the first input as an N*N
                        similarity matrix.
                        
     'SimilarityGraph'  'knn' (default) to connect each observation to its nearest
                        neighbors, or 'epsilon' to connect observations that are
                        within a fixed radius.
                        
     'NumNeighbors'     the number of nearest neighbors for the 'knn' graph, a
                        positive integer.  The default is ‘ceil (log (N))’.
                        
     'KNNGraphType'     'complete' (default) to connect i and j when either is a
                        nearest neighbor of the other, or 'mutual' to connect them
                        only when each is a nearest neighbor of the other.
                        
     'Radius'           the radius for the 'epsilon' graph, a nonnegative scalar.
                        Required when 'SimilarityGraph' is 'epsilon'.
                        
     'KernelScale'      the positive scale factor SIGMA in the Gaussian similarity
                        kernel ‘exp (-(dist / sigma)^2)’ applied to the graph
                        edges.  The default is 1.
                        
     'LaplacianNormalization''randomwalk' (default), 'symmetric', or 'none', selecting
                        how the graph Laplacian is normalized before the
                        eigendecomposition.
                        
     'ClusterMethod'    'kmeans' (default) or 'kmedoids' to cluster the eigenvector
                        embedding.
                        
     'P'                the Minkowski exponent (default 2), used only with the
                        'minkowski' distance.
                        
     'Cov'              the covariance matrix used only with the 'mahalanobis'
                        distance.
                        
     'Scale'            the scaling vector used only with the 'seuclidean'
                        distance.

     See also: kmeans, kmedoids, dbscan, linkage, pdist2.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 65
Partition observations into K clusters using spectral clustering.





