mirror of
https://github.com/Llewellynvdm/php-ml.git
synced 2025-01-09 16:36:34 +00:00
fix scalar typehint for hhvm
This commit is contained in:
parent
0a612a6031
commit
f3288c5946
@ -27,13 +27,13 @@ class KNearestNeighbors implements Classifier
|
|||||||
* @param int $k
|
* @param int $k
|
||||||
* @param Distance|null $distanceMetric (if null then Euclidean distance as default)
|
* @param Distance|null $distanceMetric (if null then Euclidean distance as default)
|
||||||
*/
|
*/
|
||||||
public function __construct(int $k = 3, Distance $distanceMetric = null)
|
public function __construct(int $k = null, Distance $distanceMetric = null)
|
||||||
{
|
{
|
||||||
if (null === $distanceMetric) {
|
if (null === $distanceMetric) {
|
||||||
$distanceMetric = new Euclidean();
|
$distanceMetric = new Euclidean();
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->k = $k;
|
$this->k = $k ?? 3;
|
||||||
$this->samples = [];
|
$this->samples = [];
|
||||||
$this->targets = [];
|
$this->targets = [];
|
||||||
$this->distanceMetric = $distanceMetric;
|
$this->distanceMetric = $distanceMetric;
|
||||||
|
Loading…
Reference in New Issue
Block a user