Class KNeighbors
java.lang.Object
ai.beestream.jitnn.ml.KNeighbors
k-nearest neighbours by brute force on the device (Euclidean distance, uniform weights), after
scikit-learn's KNeighborsClassifier and KNeighborsRegressor. Class ties go to the smallest label.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionClassification: integer labels.Regression: targets [n] or [n, t].kneighbors(Tensor q) INT32 indices [m, k] of the k nearest training rows of each query row.int[]The majority label of each query's neighbours (a classifier'sfitonly).Class probabilities [m, c]: the fraction of neighbours per class.Regression predictions [m, t].
-
Constructor Details
-
KNeighbors
public KNeighbors(int k) Neighbours by theknearest training samples.
-
-
Method Details
-
fit
Classification: integer labels. -
fit
Regression: targets [n] or [n, t]. -
kneighbors
-
predict
The majority label of each query's neighbours (a classifier'sfitonly). -
predictProba
-
predictValues
-