PHP Class Phpml\Classification\KNearestNeighbors

Inheritance: implements Classifier, use trait Phpml\Helper\Trainable, use trait Phpml\Helper\Predictable
Afficher le fichier Open project: php-ai/php-ml Class Usage Examples

Méthodes publiques

Méthode Description
__construct ( integer $k = 3, Phpml\Math\Distance $distanceMetric = null )

Méthodes protégées

Méthode Description
predictSample ( array $sample ) : mixed

Private Methods

Méthode Description
kNeighborsDistances ( array $sample ) : array

Method Details

__construct() public méthode

public __construct ( integer $k = 3, Phpml\Math\Distance $distanceMetric = null )
$k integer
$distanceMetric Phpml\Math\Distance (if null then Euclidean distance as default)

predictSample() protected méthode

protected predictSample ( array $sample ) : mixed
$sample array
Résultat mixed