mirror of
https://github.com/Llewellynvdm/php-ml.git
synced 2024-11-05 04:57:52 +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 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) {
|
||||
$distanceMetric = new Euclidean();
|
||||
}
|
||||
|
||||
$this->k = $k;
|
||||
$this->k = $k ?? 3;
|
||||
$this->samples = [];
|
||||
$this->targets = [];
|
||||
$this->distanceMetric = $distanceMetric;
|
||||
|
Loading…
Reference in New Issue
Block a user