KMeans Cluster Analysis Class
Definition
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 9.0.3
public class KMeansClusterAnalysis : ClusteringModel<double>
- Inheritance
- Object → Model → ClusteringModel<Double> → KMeansClusterAnalysis
Remarks
Use the KMeansClusterAnalysis class to perform a K-means cluster analysis of numerical data.
K-means clustering partitions a set of observations into a predefined number of clusters. A number of initial cluster centers is chosen. The observations are assigned to the closest cluster. Each center is then recalculated as the mean of its members. This changes the distances between cluster centers and observations, so the observations are once again reassigned. This process is repeated until no more observations change cluster. Note that the final partition depends on the initial location of the centers. Different applications may return different results for the same dataset.
The number of clusters must be passed in a constructor. It can be accessed through the NumberOfClusters property. The Standardize property determines whether the variables are transformed to all have the same mean and standard deviation. The default is true.
Once the clustering is computed by calling the Fit() method, the Centers property gives access to a vector of cluster centers. The Predictions property returns a CategoricalVector<T> that for each observation indicates the cluster it belongs to. It can be used to group the observations by their cluster assignment. GetDistancesToCenters() returns a Vector<T> that contains the distance of each observation to the center of its cluster.
Constructors
KMeans | Constructs a new KMeansClusterAnalysis. |
KMeans | Constructs a new KMeansClusterAnalysis. |
KMeans | Constructs a new KMeansClusterAnalysis. |
KMeans | Constructs a new KMeansClusterAnalysis. |
KMeans | Constructs a new KMeansClusterAnalysis. |
Properties
Base |
Gets an index containing the keys of the columns
that are required inputs to the model.
(Inherited from Model) |
Centers | Gets an array of cluster centers. |
Clusters | Gets an array of clusters. |
Computed |
Gets whether the model has been computed.
(Inherited from Model) Obsolete. |
Data |
Gets an object that contains all the data used as input to the model.
(Inherited from Model) |
Fitted |
Gets whether the model has been computed.
(Inherited from Model) |
Initialization | Gets or sets the method used to initialize the K-means algorithm. |
Input |
Gets the schema for the features used for fitting the model.
(Inherited from Model) |
Max |
Gets or sets the maximum degree of parallelism enabled by this instance.
(Inherited from Model) |
Model |
Gets the collection of variables used in the model.
(Inherited from Model) |
Number | Gets or sets the number of clusters. |
Number |
Gets the number of observations the model is based on.
(Inherited from Model) |
Parallel |
Gets or sets an object that specifies how the calculation of the model should be parallelized.
(Inherited from Model) |
Predictions | Returns the index of the cluster each observation belongs to as a CategoricalVector<T>. |
Random | Gets or sets the random number generator that may be used during the initialization of the K-means algorithm. |
Standardize | Gets or sets whether the variables should be standardized before the clustering is computed. |
Status |
Gets the status of the model, which determines which information is available.
(Inherited from Model) |
Supports |
Indicates whether the model supports case weights.
(Inherited from Model) |
Weights |
Gets or sets the actual weights.
(Inherited from Model) |
Methods
Compute() |
Computes the model.
(Inherited from Model) Obsolete. |
Compute( |
Computes the model.
(Inherited from Model) Obsolete. |
Equals | Determines whether the specified object is equal to the current object. (Inherited from Object) |
Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object) |
Fit() |
Fits the model to the data.
(Inherited from Model) |
Fit( |
Fits the model to the data.
(Inherited from Model) |
Fit |
Computes the clustering.
(Overrides Model.FitCore(ModelInput, ParallelOptions)) |
Get | Gets a matrix that contains the distances between the clusters. |
Get | Returns the Davis-Bouldin index for the cluster analysis. |
Get | Returns a Vector<T> that contains the distance of each observation to its cluster center. |
Get | Serves as the default hash function. (Inherited from Object) |
Get | Gets the Type of the current instance. (Inherited from Object) |
Memberwise | Creates a shallow copy of the current Object. (Inherited from Object) |
Reset |
Clears all fitted model parameters.
(Inherited from Model) Obsolete. |
Reset |
Clears all fitted model parameters.
(Inherited from Model) |
Set |
Uses the specified data frame as the source for all input variables.
(Inherited from Model) |
Summarize() |
Returns a string containing a human-readable summary of the object using default options.
(Inherited from Model) |
Summarize( |
Returns a string containing a human-readable summary of the object using the specified options.
(Overrides Model.Summarize(SummaryOptions)) |
ToString | Returns a string that represents the current object. (Inherited from Model) |