v2026.5.3
All Bundles
Bundle Machine learning library with linear regression, logistic regression, k-means clustering, and matrix operations. Designed for tabular data; supports training, prediction, and model evaluation. Compile with -lib ml.

KNeighbor

K-Neighbor result

Implements: Compare

Operations

Compare #

Compares neighbors

method : public : Compare(rhs:System.Compare) ~ Int

Parameters

NameTypeDescription
rhsCompareneighbor to compare

Return

TypeDescription
Int0 if equal, -1 if types differ, 1 if equal

GetCategory #

Get the category label

method : public : GetCategory() ~ String

Return

TypeDescription
Stringcategory label

GetDistance #

Get the distance

method : public : GetDistance() ~ Float

Return

TypeDescription
Floatdistance

GetRow #

Get the row index

method : public : GetRow() ~ Int

Return

TypeDescription
Introw index

HashID #

Returns a unique hash ID for a boolean

method : public : HashID() ~ Int

Return

TypeDescription
Inthash ID

New # constructor

Constructor.

New(dist:Float, row:Int, cat:String)

Parameters

NameTypeDescription
distFloatdistance value
rowIntrow index
catStringcategory label

ToString #

Returns a string representation of the neighbor

method : public : ToString() ~ String

Return

TypeDescription
Stringstring representation of the neighbor