Moodle PHP Documentation 4.5
Moodle 4.5dev (Build: 20240606) (d3ae1391abe)
Phpml\Classification\KNearestNeighbors Class Reference
Inheritance diagram for Phpml\Classification\KNearestNeighbors:
Phpml\Classification\Classifier Phpml\Estimator

Public Member Functions

 __construct (int $k=3, ?Distance $distanceMetric=null)
 
 predict (array $samples)
 
 train (array $samples, array $targets)
 

Protected Member Functions

 predictSample (array $sample)
 

Constructor & Destructor Documentation

◆ __construct()

Phpml\Classification\KNearestNeighbors::__construct ( int $k = 3,
?Distance $distanceMetric = null )
Parameters
Distance | null$distanceMetric(if null then Euclidean distance as default)

Member Function Documentation

◆ predict()

Phpml\Estimator::predict ( array $samples)
inherited

Implemented in Phpml\Pipeline.

◆ predictSample()

Phpml\Classification\KNearestNeighbors::predictSample ( array $sample)
protected
Return values
mixed

◆ train()

Phpml\Estimator::train ( array $samples,
array $targets )
inherited

The documentation for this class was generated from the following file: