Skip to content

Commit

Permalink
Add null coalesce operator in token count vectoriezer
Browse files Browse the repository at this point in the history
  • Loading branch information
akondas committed Dec 7, 2016
1 parent 38a26d1 commit 8aad8af
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Phpml/FeatureExtraction/TokenCountVectorizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ private function getTokenIndex(string $token)
return false;
}

return isset($this->vocabulary[$token]) ? $this->vocabulary[$token] : false;
return $this->vocabulary[$token] ?? false;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Phpml/Metric/ClassificationReport.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ private function computeF1Score(float $precision, float $recall): float
return 0.0;
}

return 2.0 * (($precision * $recall) / ($divider));
return 2.0 * (($precision * $recall) / $divider);
}

/**
Expand Down

0 comments on commit 8aad8af

Please sign in to comment.