diff --git a/src/Classification/DecisionTree.php b/src/Classification/DecisionTree.php
index 04cde56..b187796 100644
--- a/src/Classification/DecisionTree.php
+++ b/src/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/src/Classification/DecisionTree/DecisionTreeLeaf.php b/src/Classification/DecisionTree/DecisionTreeLeaf.php
index 04af3d6..3f8bd2c 100644
--- a/src/Classification/DecisionTree/DecisionTreeLeaf.php
+++ b/src/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 = "
${value} |
";
+ $str = "{$value} |
";
if ($this->leftLeaf !== null || $this->rightLeaf !== null) {
$str .= '';
diff --git a/src/Classification/Linear/DecisionStump.php b/src/Classification/Linear/DecisionStump.php
index 258939e..ae81d56 100644
--- a/src/Classification/Linear/DecisionStump.php
+++ b/src/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/src/FeatureExtraction/StopWords.php b/src/FeatureExtraction/StopWords.php
index f5622fd..1b07410 100644
--- a/src/FeatureExtraction/StopWords.php
+++ b/src/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/src/Helper/OneVsRest.php b/src/Helper/OneVsRest.php
index 691fb64..b17fc02 100644
--- a/src/Helper/OneVsRest.php
+++ b/src/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;
}