ClusterClassify

ClusterClassify[data]

generates a ClassifierFunction[] by partitioning data into clusters of similar elements.

ClusterClassify[data,n]

generates a ClassifierFunction[] with at most n clusters.

Details and Options

  • ClusterClassify works for a variety of data types, including numerical, textual, and image, as well as dates and times and combinations of these.
  • The following options can be given:
  • CriterionFunctionAutomaticcriterion for selecting a method
    DistanceFunctionAutomaticthe distance function to use
    FeatureExtractorIdentityhow to extract features from which to learn
    FeatureNamesAutomaticfeature names to assign for input data
    FeatureTypesAutomaticfeature types to assume for input data
    MethodAutomaticwhat method to use
    PerformanceGoalAutomaticaspect of performance to optimize
    RandomSeeding1234what seeding of pseudorandom generators should be done internally
    WeightsAutomaticwhat weight to give to each example
  • By default, ClusterClassify will preprocess the data automatically unless a DistanceFunction is specified.
  • The setting for DistanceFunction can be any distance or dissimilarity function, or a function f defining a distance between two values.
  • Possible settings for PerformanceGoal include:
  • Automaticautomatic tradeoff among speed, accuracy, and memory
    "Memory"minimize the storage requirements of the classifier
    "Quality"maximize the accuracy of the classifier
    "Speed"maximize the speed of the classifier
    "TrainingSpeed"minimize the time spent producing the classifier
  • Possible settings for Method include:
  • Automaticautomatically select a method
    "Agglomerate"single linkage clustering algorithm
    "DBSCAN"density-based spatial clustering of applications with noise
    "NeighborhoodContraction"displace examples toward high-density region
    "JarvisPatrick"JarvisPatrick clustering algorithm
    "KMeans"k-means clustering algorithm
    "MeanShift"mean-shift clustering algorithm
    "KMedoids"partitioning around medoids
    "SpanningTree"minimum spanning tree-based clustering algorithm
    "Spectral"spectral clustering algorithm
    "GaussianMixture"variational Gaussian mixture algorithm
  • The methods "KMeans" and "KMedoids" can only be used when the number of clusters is specified.
  • Possible settings for CriterionFunction include:
  • "StandardDeviation"root-mean-square standard deviation
    "RSquared"R-squared
    "Dunn"Dunn index
    "CalinskiHarabasz"CalinskiHarabasz index
    "DaviesBouldin"DaviesBouldin index
    Automaticinternal index
  • Possible settings for RandomSeeding include:
  • Automaticautomatically reseed every time the function is called
    Inheriteduse externally seeded random numbers
    seeduse an explicit integer or strings as a seed

Examples

open allclose all

Basic Examples  (3)

Train the ClassifierFunction on some numerical data:

In[1]:=
Click for copyable input
Out[1]=

Use the classifier function to classify a new unlabeled example:

In[2]:=
Click for copyable input
Out[2]=

Obtain classification probabilities for this example:

In[3]:=
Click for copyable input
Out[3]=

Classify multiple examples:

In[4]:=
Click for copyable input
Out[4]=

Plot the probabilities for the two different classes in the interval {-5,5}:

In[5]:=
Click for copyable input
Out[5]=

Train the ClassifierFunction on some colors by requiring the number of classes to be 5:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=

Train the ClassifierFunction on some unlabeled data:

In[3]:=
Click for copyable input
Out[3]=

Gather the elements by their class number:

In[4]:=
Click for copyable input
Out[4]=

Train the ClassifierFunction on some strings:

In[1]:=
Click for copyable input
In[2]:=
Click for copyable input
Out[2]=
In[3]:=
Click for copyable input
Out[3]=

Gather the elements by their class number:

In[4]:=
Click for copyable input
Out[4]=

Scope  (11)

Options  (9)

Applications  (3)

See Also

FindClusters  ClusteringComponents  Classify  DimensionReduction  ClusteringTree  Dendrogram  Nearest  DistanceMatrix

Introduced in 2016
(10.4)
| Updated in 2017
(11.2)