diff --git a/lib/mlbackend/php/phpml/readme_moodle.txt b/lib/mlbackend/php/phpml/readme_moodle.txt index df47da5bc03..aec95619a3f 100644 --- a/lib/mlbackend/php/phpml/readme_moodle.txt +++ b/lib/mlbackend/php/phpml/readme_moodle.txt @@ -1,8 +1,13 @@ Current version is 0.8.0 -# Download latest stable version from https://github.com/php-ai/php-ml +# Download latest stable version from https://github.com/jorgecasas/php-ml # Remove all files but: * src/ * LICENSE # Copy content of src/ to /path/to/moodle/lib/mlbackend/php/phpml/src/Phpml # Copy LICENSE file to /path/to/moodle/lib/mlbackend/php/phpml +# Applied patch https://github.com/jorgecasas/php-ml/pull/5 + +2023/01/26 +---------- +- Changing the repository URL to https://github.com/jorgecasas/php-ml diff --git a/lib/mlbackend/php/phpml/src/Phpml/Classification/DecisionTree.php b/lib/mlbackend/php/phpml/src/Phpml/Classification/DecisionTree.php index 04cde5621e5..b187796e5f1 100644 --- a/lib/mlbackend/php/phpml/src/Phpml/Classification/DecisionTree.php +++ b/lib/mlbackend/php/phpml/src/Phpml/Classification/DecisionTree.php @@ -386,9 +386,9 @@ class DecisionTree implements Classifier $median = Mean::median($values); foreach ($values as &$value) { if ($value <= $median) { - $value = "<= ${median}"; + $value = "<= {$median}"; } else { - $value = "> ${median}"; + $value = "> {$median}"; } } } diff --git a/lib/mlbackend/php/phpml/src/Phpml/Classification/DecisionTree/DecisionTreeLeaf.php b/lib/mlbackend/php/phpml/src/Phpml/Classification/DecisionTree/DecisionTreeLeaf.php index 04af3d62dbe..3f8bd2c5fc3 100644 --- a/lib/mlbackend/php/phpml/src/Phpml/Classification/DecisionTree/DecisionTreeLeaf.php +++ b/lib/mlbackend/php/phpml/src/Phpml/Classification/DecisionTree/DecisionTreeLeaf.php @@ -122,7 +122,7 @@ class DecisionTreeLeaf public function getHTML(?array $columnNames = null): string { if ($this->isTerminal) { - $value = "${this}->classValue"; + $value = "{$this}->classValue"; } else { $value = $this->value; if ($columnNames !== null) { @@ -132,13 +132,13 @@ class DecisionTreeLeaf } if ((bool) preg_match('/^[<>=]{1,2}/', (string) $value) === false) { - $value = "=${value}"; + $value = "={$value}"; } - $value = "${col} ${value}
Gini: ".number_format($this->giniIndex, 2); + $value = "{$col} {$value}
Gini: ".number_format($this->giniIndex, 2); } - $str = ""; + $str = "
${value}
"; if ($this->leftLeaf !== null || $this->rightLeaf !== null) { $str .= ''; diff --git a/lib/mlbackend/php/phpml/src/Phpml/Classification/Linear/DecisionStump.php b/lib/mlbackend/php/phpml/src/Phpml/Classification/Linear/DecisionStump.php index 258939e3a49..ae81d563da0 100644 --- a/lib/mlbackend/php/phpml/src/Phpml/Classification/Linear/DecisionStump.php +++ b/lib/mlbackend/php/phpml/src/Phpml/Classification/Linear/DecisionStump.php @@ -87,7 +87,7 @@ class DecisionStump extends WeightedClassifier public function __toString(): string { - return "IF ${this}->column ${this}->operator ${this}->value ". + return "IF {$this->column} {$this->operator} {$this->value} ". 'THEN '.$this->binaryLabels[0].' '. 'ELSE '.$this->binaryLabels[1]; } diff --git a/lib/mlbackend/php/phpml/src/Phpml/FeatureExtraction/StopWords.php b/lib/mlbackend/php/phpml/src/Phpml/FeatureExtraction/StopWords.php index f5622fd61d0..1b074105541 100644 --- a/lib/mlbackend/php/phpml/src/Phpml/FeatureExtraction/StopWords.php +++ b/lib/mlbackend/php/phpml/src/Phpml/FeatureExtraction/StopWords.php @@ -25,7 +25,7 @@ class StopWords public static function factory(string $language = 'English'): self { - $className = __NAMESPACE__."\\StopWords\\${language}"; + $className = __NAMESPACE__."\\StopWords\\{$language}"; if (!class_exists($className)) { throw new InvalidArgumentException(sprintf('Can\'t find "%s" language for StopWords', $language)); diff --git a/lib/mlbackend/php/phpml/src/Phpml/Helper/OneVsRest.php b/lib/mlbackend/php/phpml/src/Phpml/Helper/OneVsRest.php index 691fb6437f0..b17fc025e12 100644 --- a/lib/mlbackend/php/phpml/src/Phpml/Helper/OneVsRest.php +++ b/lib/mlbackend/php/phpml/src/Phpml/Helper/OneVsRest.php @@ -157,7 +157,7 @@ trait OneVsRest */ private function binarizeTargets(array $targets, $label): array { - $notLabel = "not_${label}"; + $notLabel = "not_{$label}"; foreach ($targets as $key => $target) { $targets[$key] = $target == $label ? $label : $notLabel; }
{$value}