Moodle PHP Documentation 4.3
Moodle 4.3.5 (Build: 20240610) (7dcfaa79f78)
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: