1
val model = new LogisticRegressionModel(
Vectors.dense(weightsWithIntercept.toArray.slice(0,weightsWithIntercept.size - 1)),
weightsWithIntercept(weightsWithIntercept.size - 1))
// Clear the default threshold.
model.clearThreshold()
// Compute raw scores on the test set.
val scoreAndLabels = test.map { point =>
val score = model.predict(point.features)
(score, point.label)
をmodel.prediction(point.features)は、超平面分離までの距離のマージンである生のスコアを返します。
私の質問は:
(1)どのように予測クラスラベルは、上記の計算生のスコアに基づいて0または1であれば、私が知ることができますか?
または
(2)上記算出生スコアからこのバイナリ分類場合に予測されるクラスラベル(0または1)を推測する方法?
アルゴリズムがROC曲線を計算するために決定する最適なしきい値を得るにはどうすればよいですか? – Tom
メトリックオブジェクトでは、さまざまなメトリックのしきい値(たとえば、val f1Score = metrics.fMeasureByThreshold)を使用してスコアを取得できます。次に、ここで最高のしきい値の詳細を見つけるために反復することができます:https://spark.apache.org/docs/latest/mllib-evaluation-metrics.html –