精度

分類器の精度を計算するためのクラス

スコア

分類器の精度のスコアを計算するには、score static メソッドを使ってください。パラメータ:

  • $actualLabels - (array) 真の標本ラベル
  • $predictedLabels - (array) 予測ラベル (例えば、テストグループから)
  • $normalize - (bool) normalize or not the result (default: true)

$actualLabels = ['a', 'b', 'a', 'b'];
$predictedLabels = ['a', 'a', 'a', 'b'];

Accuracy::score($actualLabels, $predictedLabels);
// return 0.75

Accuracy::score($actualLabels, $predictedLabels, false);
// return 3