Hands-On Neural Network Programming with C#
上QQ阅读APP看书,第一时间看更新

F1 score

To talk about an f1 score we must first talk about Precision and Recall.

Precision is the ratio of correctly predicted positive observations divided by the total predicted positive observations. Less formally, of all the people that said they were coming, how many came?

Recall (sensitivity) is the ratio of correctly predicted positive observations to all observations in total.

F1 score is then the weighted average of Precision and Recall.

Here’s how we calculate an f1 score using SharpLearning:

var targets = new double[] { 0, 1, 1 };
var predictions = new double[] { 0, 1, 1 };
var sut = new F1ScoreMetric<double>(1);
var actual = sut.Error(targets, predictions);
Assert.AreEqual(0.0, actual);