From 9899da7143965f1dfe49c4f3ebc317297fef7ce2 Mon Sep 17 00:00:00 2001 From: Arkadiusz Kondas Date: Thu, 7 Apr 2016 23:08:04 +0200 Subject: [PATCH] remove count from test condition --- composer.json | 2 +- src/Phpml/Metric/Distance.php | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) 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); }