Skip to content

Commit 4d974b3

Browse files
committed
add quad error sample
1 parent ba7d63e commit 4d974b3

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

MLTests/PredictionCompareLearnTest.cs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
using FluentAssertions;
2+
using NUnit.Framework;
3+
4+
namespace MLTests
5+
{
6+
public class PredictionCompareLearnTest
7+
{
8+
[Test]
9+
public void ShouldGetSimpleLearnError()
10+
{
11+
var weight = 0.5;
12+
var input = 0.5;
13+
14+
var goal = 0.8;
15+
16+
var prediction = input * weight;
17+
18+
var error = Math.Round(Math.Pow(goal - prediction, 2), 2);
19+
error.Should().Be(0.3);
20+
}
21+
}
22+
}

0 commit comments

Comments
 (0)