KNN
Extends:
k-nearest neighbours learner. Classifies points based on the (possibly weighted) vote of its k nearest neighbours (euclidian distance).
Constructor Summary
Public Constructor | ||
public |
constructor(optionsUser: Object) Constructor. |
Member Summary
Public Members | ||
public |
|
|
public |
training: {"X": *, "y": *} |
Method Summary
Public Methods | ||
public |
predict(X: *): * |
|
public |
predictSample(sampleFeatures: Array<number>): mixed Make a prediction for a single sample. |
|
public |
train(X: *, y: *) |
Inherited Summary
From class Estimator | ||
public abstract |
Make a prediction for a data set. |
|
public abstract |
Train the supervised learning algorithm on a dataset. |
From class Neighbors | ||
public |
training: {"X": *, "y": *} |
|
public |
train(X: *, y: *) |
Public Constructors
Public Members
public numNeighbours: * source
Public Methods
public predict(X: *): * source
Make a prediction for a data set.
Override:
Estimator#predictParams:
Name | Type | Attribute | Description |
X | * |
Return:
* |
public predictSample(sampleFeatures: Array<number>): mixed source
Make a prediction for a single sample.
Return:
mixed | Prediction. Label of class with highest prevalence among k nearest neighbours |
public train(X: *, y: *) source
Train the supervised learning algorithm on a dataset.
Override:
Neighbors#trainParams:
Name | Type | Attribute | Description |
X | * | ||
y | * |