diff --git a/composer.json b/composer.json index 66083b2..d3569d0 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "php-ai/php-ml", "type": "library", - "description": "PHP Machine learning library", + "description": "PHP Machine Learning library", "license": "MIT", "keywords": ["machine learning","pattern recognition","computational learning theory","artificial intelligence"], "homepage": "https://github.com/php-ai/php-ml", diff --git a/src/Phpml/Metric/Distance.php b/src/Phpml/Metric/Distance.php index e0dce2d..1b92cef 100644 --- a/src/Phpml/Metric/Distance.php +++ b/src/Phpml/Metric/Distance.php @@ -23,8 +23,9 @@ class Distance } $distance = 0; + $count = count($a); - for ($i = 0; $i < count($a); ++$i) { + for ($i = 0; $i < $count; ++$i) { $distance += pow($a[$i] - $b[$i], 2); }