214 references to Equal
Microsoft.DotNet.XUnitAssert.Tests (8)
EqualityAssertsTests.cs (8)
2061
var ex = Record.Exception(() => Assert.
Equal
(0.0, 1.0, double.NegativeInfinity));
2071
Assert.
Equal
(10.566, 10.565, 0.01);
2081
var ex = Record.Exception(() => Assert.
Equal
(0.11113, 0.11115, 0.00001));
2095
Assert.
Equal
(double.NaN, double.NaN, 1000.0);
2105
var ex = Record.Exception(() => Assert.
Equal
(20210102.2208, double.NaN, 20000000.0));
2119
Assert.
Equal
(double.MinValue, double.MaxValue, double.PositiveInfinity);
2129
var ex = Record.Exception(() => Assert.
Equal
(double.PositiveInfinity, 77.7, 1.0));
2147
var ex = Record.Exception(() => Assert.
Equal
(0.0, double.NegativeInfinity, 1.0));
Microsoft.ML.Core.Tests (15)
UnitTests\TestEntryPoints.cs (11)
97
Assert.
Equal
(0.9, (double)trainRows / totalRows, 0.1);
5008
Assert.
Equal
(0.93, auc, 0.01);
5211
Assert.
Equal
(1.585, stdev, .001);
5213
Assert.
Equal
(1.39, stdev, 0.01);
5382
Assert.
Equal
(0.024809923969586353, stdev, 0.001);
5791
Assert.
Equal
(0.02582, stdev, 0.00001);
6092
Assert.
Equal
(0.02462, stdevValues[0], 0.00001);
6093
Assert.
Equal
(0.02763, stdevValues[1], 0.00001);
6094
Assert.
Equal
(0.03273, stdevValues[2], 0.00001);
6294
Assert.
Equal
(0.96, acc, 0.01);
6466
Assert.
Equal
(0.71, acc, 0.01);
UnitTests\TestLoss.cs (3)
42
Assert.
Equal
(expectedLoss, loss, 0.00001);
43
Assert.
Equal
(expectedUpdate, -derivative, 0.00001);
51
Assert.
Equal
((almostLoss - loss) / (almostOutput - output), derivative, 0.1);
UnitTests\TestVBuffer.cs (1)
296
Assert.
Equal
(expectedValues[i], actualValues[i], 0.000001);
Microsoft.ML.CpuMath.UnitTests (9)
UnitTests.cs (9)
644
Assert.
Equal
((double)expected, (double)actual, 0.01);
667
Assert.
Equal
((double)expected, (double)actual, 0.01);
692
Assert.
Equal
((double)expected, (double)actual, 0.1);
715
Assert.
Equal
((double)expected, (double)actual, 0.01);
740
Assert.
Equal
((double)expected, (double)actual, 0.01);
768
Assert.
Equal
((double)expected, (double)actual, 0.01);
796
Assert.
Equal
((double)expected, (double)actual, 0.01);
826
Assert.
Equal
((double)expected, (double)actual, 0.1);
860
Assert.
Equal
((double)expected, (double)actual, 0.01);
Microsoft.ML.Fairlearn.Tests (15)
MetricTest.cs (11)
41
Assert.
Equal
(-2.30578, Convert.ToSingle(metricByGroup["RSquared"][0]), 0.001);
42
Assert.
Equal
(-2039.81453, Convert.ToSingle(metricByGroup["RSquared"][1]), 0.001);
43
Assert.
Equal
(1.00000, Convert.ToSingle(metricByGroup["RMS"][0]), 0.001);
44
Assert.
Equal
(15.811388, Convert.ToSingle(metricByGroup["RMS"][1]), 0.001);
47
Assert.
Equal
(125.5, metricOverall["MSE"], 0.1);
48
Assert.
Equal
(11.202678, metricOverall["RMS"], 0.0001);
50
Assert.
Equal
(14.81138, diff["RMS"], 0.0001);
51
Assert.
Equal
(2037.5, diff["RSquared"], 0.1);
73
Assert.
Equal
(0.8, Convert.ToSingle(metricByGroup["Accuracy"][0]), 0.1);
74
Assert.
Equal
(0.6, Convert.ToSingle(metricByGroup["Accuracy"][1]), 0.1);
76
Assert.
Equal
(0.7, Convert.ToSingle(metricOverall["Accuracy"]), 0.1);
UtilityTest.cs (4)
34
Assert.
Equal
(0.1, Convert.ToSingle(gSinged["value"][0]), 0.1);
35
Assert.
Equal
(-0.1, Convert.ToSingle(gSinged["value"][1]), 0.1);
36
Assert.
Equal
(-0.1, Convert.ToSingle(gSinged["value"][2]), 0.1);
37
Assert.
Equal
(0.1, Convert.ToSingle(gSinged["value"][3]), 0.1);
Microsoft.ML.IntegrationTests (5)
IntrospectiveTraining.cs (2)
122
Assert.
Equal
(expectedSplitGains[i], finalTree.SplitGains[i], 0.000001);
123
Assert.
Equal
((double)expectedThresholds[i], (double)finalTree.NumericalSplitThresholds[i], 0.000001);
ONNX.cs (2)
74
Assert.
Equal
(originalPrediction.Score, onnxPrediction.Score[0], 0.0001);
173
Assert.
Equal
(originalPrediction.Score, onnxPrediction.Score[0], 0.0001);
Training.cs (1)
501
Assert.
Equal
(0.4367, binaryClassificationMetrics.LogLoss, 0.0001);
Microsoft.ML.OnnxTransformerTest (3)
OnnxTransformTests.cs (3)
567
Assert.
Equal
(-0.080, predictions[0].variable[0], 0.001);
568
Assert.
Equal
(1.204, predictions[1].variable[0], 0.001);
569
Assert.
Equal
(2.27, predictions[2].variable[0], 0.001);
Microsoft.ML.Predictor.Tests (3)
TestGamPublicInterfaces.cs (1)
46
Assert.
Equal
(intercept, gam.Bias, 0.000001);
TestPredictors.cs (2)
740
Assert.
Equal
(score, 0.4 * scores.Sum() / predCount, 0.00001);
741
Assert.
Equal
(prob, 1 / (1 + Math.Exp(-score)), 0.000001);
Microsoft.ML.TensorFlow.Tests (13)
TensorflowTests.cs (13)
162
Assert.
Equal
(1, metrics.MicroAccuracy, 0.01);
169
Assert.
Equal
(0d, prediction.PredictedScores[0], 0.01);
170
Assert.
Equal
(1d, prediction.PredictedScores[1], 0.01);
171
Assert.
Equal
(0d, prediction.PredictedScores[2], 0.01);
177
Assert.
Equal
(0d, prediction.PredictedScores[0], 0.01);
178
Assert.
Equal
(0d, prediction.PredictedScores[1], 0.01);
179
Assert.
Equal
(1d, prediction.PredictedScores[2], 0.01);
677
Assert.
Equal
(0.99, metrics.MicroAccuracy, .01);
678
Assert.
Equal
(0.93, metrics.MacroAccuracy, 0.01);
902
Assert.
Equal
(0.99, metrics.MicroAccuracy, .01);
903
Assert.
Equal
(.93, metrics.MacroAccuracy, 0.01);
1173
Assert.
Equal
(1, metrics.MicroAccuracy, 0.01);
1208
Assert.
Equal
((double)predictions[i].PredictedScores[j], (double)testPredictions[i].PredictedScores[j], 0.01);
Microsoft.ML.Tests (112)
AnomalyDetectionTests.cs (2)
36
Assert.
Equal
(0.98667, metrics.AreaUnderRocCurve, 0.00001);
37
Assert.
Equal
(0.90000, metrics.DetectionRateAtFalsePositiveCount, 0.00001);
EvaluateTests.cs (1)
68
Assert.
Equal
(expectedTopKArray2[i], output2[i], 0.0000001);
LearningRateSchedulerTest.cs (1)
51
Assert.
Equal
((double)expectedValues[i], (double)decayedLR, 0.0001);
Scenarios\ClusteringTests.cs (1)
90
Assert.
Equal
(0d, metrics.AverageDistance, 0.00001);
Scenarios\IrisPlantClassificationTests.cs (14)
58
Assert.
Equal
(1d, prediction.PredictedLabels[0], 0.01);
59
Assert.
Equal
(0d, prediction.PredictedLabels[1], 0.01);
60
Assert.
Equal
(0d, prediction.PredictedLabels[2], 0.01);
70
Assert.
Equal
(0d, prediction.PredictedLabels[0], 0.01);
71
Assert.
Equal
(0d, prediction.PredictedLabels[1], 0.01);
72
Assert.
Equal
(1d, prediction.PredictedLabels[2], 0.01);
82
Assert.
Equal
(.2, prediction.PredictedLabels[0], 0.1);
83
Assert.
Equal
(.8, prediction.PredictedLabels[1], 0.1);
84
Assert.
Equal
(0d, prediction.PredictedLabels[2], 0.01);
91
Assert.
Equal
(.98, metrics.MicroAccuracy, 0.01);
92
Assert.
Equal
(.06, metrics.LogLoss, 0.01);
96
Assert.
Equal
(0d, metrics.PerClassLogLoss[0], 0.1);
97
Assert.
Equal
(.1, metrics.PerClassLogLoss[1], 0.1);
98
Assert.
Equal
(.1, metrics.PerClassLogLoss[2], 0.1);
Scenarios\IrisPlantClassificationWithStringLabelTests.cs (14)
57
Assert.
Equal
(1d, prediction.PredictedScores[0], 0.01);
58
Assert.
Equal
(0d, prediction.PredictedScores[1], 0.01);
59
Assert.
Equal
(0d, prediction.PredictedScores[2], 0.01);
70
Assert.
Equal
(0d, prediction.PredictedScores[0], 0.01);
71
Assert.
Equal
(0d, prediction.PredictedScores[1], 0.01);
72
Assert.
Equal
(1d, prediction.PredictedScores[2], 0.01);
83
Assert.
Equal
(.2, prediction.PredictedScores[0], 0.1);
84
Assert.
Equal
(.8, prediction.PredictedScores[1], 0.1);
85
Assert.
Equal
(0d, prediction.PredictedScores[2], 0.01);
93
Assert.
Equal
(.98, metrics.MicroAccuracy, 0.01);
94
Assert.
Equal
(.06, metrics.LogLoss, 0.01);
99
Assert.
Equal
(0d, metrics.PerClassLogLoss[0], 0.1);
100
Assert.
Equal
(.1, metrics.PerClassLogLoss[1], 0.1);
101
Assert.
Equal
(.1, metrics.PerClassLogLoss[2], 0.1);
ScenariosWithDirectInstantiation\IrisPlantClassificationTests.cs (13)
64
Assert.
Equal
(1d, prediction.PredictedLabels[0], 0.01);
65
Assert.
Equal
(0d, prediction.PredictedLabels[1], 0.01);
66
Assert.
Equal
(0d, prediction.PredictedLabels[2], 0.01);
76
Assert.
Equal
(0d, prediction.PredictedLabels[0], 0.01);
77
Assert.
Equal
(0d, prediction.PredictedLabels[1], 0.01);
78
Assert.
Equal
(1d, prediction.PredictedLabels[2], 0.01);
88
Assert.
Equal
(.2, prediction.PredictedLabels[0], 0.1);
89
Assert.
Equal
(.8, prediction.PredictedLabels[1], 0.1);
90
Assert.
Equal
(0d, prediction.PredictedLabels[2], 0.01);
96
Assert.
Equal
(.98, metrics.MicroAccuracy, 0.01);
101
Assert.
Equal
(0d, metrics.PerClassLogLoss[0], 0.1);
102
Assert.
Equal
(.1, metrics.PerClassLogLoss[1], 0.1);
103
Assert.
Equal
(.1, metrics.PerClassLogLoss[2], 0.1);
TrainerEstimators\MatrixFactorizationTests.cs (14)
99
Assert.
Equal
(0.3041052520275116, leftMatrix[0], 0.0001);
101
Assert.
Equal
(0.309137582778931, leftMatrix[0], 0.0001);
102
Assert.
Equal
(0.468956589698792, leftMatrix[leftMatrix.Count - 1], 0.0001);
103
Assert.
Equal
(0.303486406803131, rightMatrix[0], 0.0001);
104
Assert.
Equal
(0.503888845443726, rightMatrix[rightMatrix.Count - 1], 0.0001);
690
Assert.
Equal
(0.987113833, firstElement.Score, 0.001);
691
Assert.
Equal
(1d, firstElement.Value, 0.001);
695
Assert.
Equal
(0.149993762, lastElement.Score, 0.001);
696
Assert.
Equal
(0.15, lastElement.Value, 0.001);
708
Assert.
Equal
(0.987113833, firstElement.Score, 0.001);
709
Assert.
Equal
(1d, firstElement.Value, 0.001);
713
Assert.
Equal
(0.987113833, lastElement.Score, 0.001);
714
Assert.
Equal
(1d, lastElement.Value, 0.001);
845
Assert.
Equal
((double)predictions[i].Score, (double)valuesAtSecondColumn[i], 0.001);
TrainerEstimators\SdcaTests.cs (8)
132
Assert.
Equal
(0.9658, metrics1.AreaUnderRocCurve, 0.0001);
133
Assert.
Equal
(0.3488, metrics1.LogLoss, 0.0001);
134
Assert.
Equal
(0.9596, metrics2.AreaUnderRocCurve, 0.0001);
135
Assert.
Equal
(0.3591, metrics2.LogLoss, 0.0001);
191
Assert.
Equal
(0.9100, metrics1.TopKAccuracy, 0.0001);
192
Assert.
Equal
(0.2411, metrics1.LogLoss, 0.0001);
193
Assert.
Equal
(0.8800, metrics2.TopKAccuracy, 0.0001);
194
Assert.
Equal
(0.2464, metrics2.LogLoss, 0.0001);
TrainerEstimators\TreeEnsembleFeaturizerTest.cs (4)
630
Assert.
Equal
(metrics.MeanAbsoluteError, loadedMetrics.MeanAbsoluteError, 0.00001);
631
Assert.
Equal
(metrics.MeanSquaredError, loadedMetrics.MeanSquaredError, 0.00001);
690
Assert.
Equal
(metrics.MeanAbsoluteError, loadedMetrics.MeanAbsoluteError, 0.00001);
691
Assert.
Equal
(metrics.MeanSquaredError, loadedMetrics.MeanSquaredError, 0.00001);
TrainerEstimators\TreeEstimators.cs (8)
564
Assert.
Equal
(nativeResult0[j + i * _classNumber], mlnetPredictions[i].Score[j], 0.000001);
572
Assert.
Equal
(prob / sum, mlnetPredictions[i].Score[j], 0.000001);
600
Assert.
Equal
(nativeResult0[j + i * _classNumber], mlnetPredictions[i].Score[j], 0.000001);
608
Assert.
Equal
(prob / sum, mlnetPredictions[i].Score[j], 0.000001);
671
Assert.
Equal
(nativeResult0[j + i * _classNumber], mlnetPredictions[i].Score[j], 0.000001);
677
Assert.
Equal
(prob / sum, mlnetPredictions[i].Score[j], 0.000001);
700
Assert.
Equal
(nativeResult0[j + i * _classNumber], mlnetPredictions[i].Score[j], 0.000001);
706
Assert.
Equal
(prob / sum, mlnetPredictions[i].Score[j], 0.000001);
Transformers\NormalizerTests.cs (32)
398
Assert.
Equal
(1 / 1.8, floatAffineModel.Scale, 0.01);
399
Assert.
Equal
(5.8d, floatAffineModel.Offset, 0.01);
403
Assert.
Equal
(.5555556, floatAffineModelVec.Scale[0], 0.01);
404
Assert.
Equal
(.8333333, floatAffineModelVec.Scale[1], 0.01);
405
Assert.
Equal
(.3389830, floatAffineModelVec.Scale[2], 0.01);
406
Assert.
Equal
(.8333333, floatAffineModelVec.Scale[3], 0.01);
408
Assert.
Equal
(5.8, floatAffineModelVec.Offset[0], 0.01);
409
Assert.
Equal
(3d, floatAffineModelVec.Offset[1], 0.01);
410
Assert.
Equal
(4.4, floatAffineModelVec.Offset[2], 0.01);
411
Assert.
Equal
(1.3, floatAffineModelVec.Offset[3], 0.01);
414
Assert.
Equal
(1 / 1.8, doubleAffineModel.Scale, 0.01);
415
Assert.
Equal
(5.8, doubleAffineModel.Offset, 0.01);
419
Assert.
Equal
(.5555556, doubleAffineModelVector.Scale[0], 0.01);
420
Assert.
Equal
(.8333333, doubleAffineModelVector.Scale[1], 0.01);
421
Assert.
Equal
(.3389830, doubleAffineModelVector.Scale[2], 0.01);
422
Assert.
Equal
(.8333333, doubleAffineModelVector.Scale[3], 0.01);
424
Assert.
Equal
(5.8, doubleAffineModelVector.Offset[0], 0.01);
425
Assert.
Equal
(3, doubleAffineModelVector.Offset[1], 0.01);
426
Assert.
Equal
(4.4, doubleAffineModelVector.Offset[2], 0.01);
427
Assert.
Equal
(1.3, doubleAffineModelVector.Offset[3], 0.01);
438
Assert.
Equal
(1 / 1.8, floatAffineModel.Scale, 0.01);
439
Assert.
Equal
(0d, floatAffineModel.Offset, 0.01);
443
Assert.
Equal
(.5555556, floatAffineModelVec.Scale[0], 0.01);
444
Assert.
Equal
(.8333333, floatAffineModelVec.Scale[1], 0.01);
445
Assert.
Equal
(.3389830, floatAffineModelVec.Scale[2], 0.01);
446
Assert.
Equal
(.8333333, floatAffineModelVec.Scale[3], 0.01);
451
Assert.
Equal
(1 / 1.8, doubleAffineModel.Scale, 0.01);
452
Assert.
Equal
(0, doubleAffineModel.Offset, 0.01);
456
Assert.
Equal
(.5555556, doubleAffineModelVector.Scale[0], 0.01);
457
Assert.
Equal
(.8333333, doubleAffineModelVector.Scale[1], 0.01);
458
Assert.
Equal
(.3389830, doubleAffineModelVector.Scale[2], 0.01);
459
Assert.
Equal
(.8333333, doubleAffineModelVector.Scale[3], 0.01);
Microsoft.ML.TimeSeries.Tests (31)
TimeSeriesDirectApi.cs (27)
198
Assert.
Equal
(expectedValues[index++], row.Change[0], 0.0000001); // Alert
199
Assert.
Equal
(expectedValues[index++], row.Change[1], 0.0000001); // Raw score
200
Assert.
Equal
(expectedValues[index++], row.Change[2], 0.0000001); // P-Value score
201
Assert.
Equal
(expectedValues[index++], row.Change[3], 0.0000001); // Martingale score
258
Assert.
Equal
(1.1661833524703979, prediction2.Change[1], 0.00001); // Raw score
261
Assert.
Equal
(0.12216401100158691, prediction2.Change[1], 0.00001); // Raw score
278
Assert.
Equal
(0.12216401100158691, prediction2.Change[1], 0.00001); // Raw score
321
Assert.
Equal
(0, prediction.Change[0], 0.0000001); // Alert
322
Assert.
Equal
(1.1661833524703979, prediction.Change[1], 0.00001); // Raw score
323
Assert.
Equal
(0.5, prediction.Change[2], 0.0000001); // P-Value score
324
Assert.
Equal
(5.1200000000000114E-08, prediction.Change[3], 0.0000001); // Martingale score
332
Assert.
Equal
(0, prediction.Change[0], 0.0000001); // Alert
333
Assert.
Equal
(0.12216401100158691, prediction.Change[1], 0.00001); // Raw score
334
Assert.
Equal
(0.14823824685192111, prediction.Change[2], 0.00001); // P-Value score
335
Assert.
Equal
(1.5292508189989167E-07, prediction.Change[3], 0.0000001); // Martingale score
345
Assert.
Equal
(0, prediction.Change[0], 0.0000001); // Alert
346
Assert.
Equal
(0.12216401100158691, prediction.Change[1], 0.00001); // Raw score
347
Assert.
Equal
(0.14823824685192111, prediction.Change[2], 0.00001); // P-Value score
348
Assert.
Equal
(1.5292508189989167E-07, prediction.Change[3], 0.00001); // Martingale score
408
Assert.
Equal
(expectedForecast[localIndex], row.Forecast[localIndex], 0.0000001);
409
Assert.
Equal
(minCnf[localIndex], row.MinCnf[localIndex], 0.0000001);
410
Assert.
Equal
(maxCnf[localIndex], row.MaxCnf[localIndex], 0.0000001);
648
Assert.
Equal
(5.00, prediction.Prediction[3], 0.01);
658
Assert.
Equal
(5.00, prediction.Prediction[3], 0.01);
659
Assert.
Equal
(5.00, prediction.Prediction[4], 0.01);
660
Assert.
Equal
(5.01, prediction.Prediction[5], 0.01);
661
Assert.
Equal
(4.99, prediction.Prediction[6], 0.01);
TimeSeriesSimpleApiTests.cs (4)
69
Assert.
Equal
(expectedValues[index++], row.Data[0], 0.0000001);
70
Assert.
Equal
(expectedValues[index++], row.Data[1], 0.0000001);
71
Assert.
Equal
(expectedValues[index++], row.Data[2], 0.0000001);
72
Assert.
Equal
(expectedValues[index++], row.Data[3], 0.0000001);