Constructor Summary
Public Constructor | ||
public |
constructor(optionsUser: Object) Constructor. |
Member Summary
Public Members | ||
public |
centroids: *[] |
|
public |
|
|
public |
numClusters: * |
|
public |
numFeatures: * |
|
public |
numSamples: * |
Method Summary
Public Methods | ||
public |
cluster(X: *): * |
|
public |
initializeCentroids(X: Array<Array<number>>) Initialize the centroids of each of the clusters based on the user's settings |
|
public |
train(X: *) |
Inherited Summary
From class Clusterer | ||
public |
Assign clusters to samples. |
|
public abstract |
Run the clustering algorithm on a dataset and obtain the cluster predictions per class. |
Public Constructors
public constructor(optionsUser: Object) source
Constructor. Initialize class members and store user-defined options.
Params:
Name | Type | Attribute | Description |
optionsUser | Object |
|
User-defined options for KNN |
optionsUser.numClusters | number |
|
Number of clusters to assign in total |
optionsUser.initialization | string |
|
Initialization procedure for cluster centers. Either 'random', for randomly selecting (without replacement) a datapoint for each cluster center, or 'kmeans++', for initializing cluster centroids with the kmeans++ procedure |
Public Members
public centroids: *[] source
public initialization: * source
public numClusters: * source
public numFeatures: * source
public numSamples: * source
Public Methods
public cluster(X: *): * source
Assign clusters to samples.
Override:
Clusterer#clusterParams:
Name | Type | Attribute | Description |
X | * |
Return:
* |
public initializeCentroids(X: Array<Array<number>>) source
Initialize the centroids of each of the clusters based on the user's settings
public train(X: *) source
Run the clustering algorithm on a dataset and obtain the cluster predictions per class.
Override:
Clusterer#trainParams:
Name | Type | Attribute | Description |
X | * |