Skip to content

Commit fbd1b93

Browse files
authored
nrBinsFix and re-enabling related tests (#4869)
1 parent 34f5763 commit fbd1b93

File tree

4 files changed

+13
-15
lines changed

4 files changed

+13
-15
lines changed

src/Microsoft.ML.Recommender/MatrixFactorizationTrainer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ private MatrixFactorizationModelParameters TrainCore(IChannel ch, RoleMappedData
513513

514514
private SafeTrainingAndModelBuffer PrepareBuffer()
515515
{
516-
return new SafeTrainingAndModelBuffer(_host, _fun, _k, _threads, Math.Max(20, 2 * _threads),
516+
return new SafeTrainingAndModelBuffer(_host, _fun, _k, _threads, _threads == 1 ? 1 : Math.Max(20, 2 * _threads),
517517
_iter, _lambda, _eta, _alpha, _c, _doNmf, _quiet, copyData: false);
518518
}
519519

test/Microsoft.ML.Core.Tests/UnitTests/TestEntryPoints.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2124,7 +2124,6 @@ public void EntryPointMulticlassPipelineEnsemble()
21242124

21252125
[LessThanNetCore30OrNotNetCoreFact("netcoreapp3.0 output differs from Baseline")]
21262126
//Skipping test temporarily. This test will be re-enabled once the cause of failures has been determined
2127-
[Trait("Category", "SkipInCI")]
21282127
public void EntryPointPipelineEnsembleGetSummary()
21292128
{
21302129
var dataPath = GetDataPath("breast-cancer-withheader.txt");
@@ -6194,7 +6193,6 @@ public void TestOvaMacro()
61946193

61956194
[Fact]
61966195
//Skipping test temporarily. This test will be re-enabled once the cause of failures has been determined
6197-
[Trait("Category", "SkipInCI")]
61986196
public void TestOvaMacroWithUncalibratedLearner()
61996197
{
62006198
var dataPath = GetDataPath(@"iris.txt");

test/Microsoft.ML.Predictor.Tests/TestPredictors.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,6 @@ public void MulticlassSdcaTest()
189189
[TestCategory("Logistic Regression")]
190190
[TestCategory("FastTree")]
191191
//Skipping test temporarily. This test will be re-enabled once the cause of failures has been determined
192-
[Trait("Category", "SkipInCI")]
193192
public void MulticlassTreeFeaturizedLRTest()
194193
{
195194
RunMTAThread(() =>

test/Microsoft.ML.Tests/TrainerEstimators/MatrixFactorizationTests.cs

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ public void MatrixFactorization_Estimator()
5555

5656
[MatrixFactorizationFact]
5757
//Skipping test temporarily. This test will be re-enabled once the cause of failures has been determined
58-
[Trait("Category", "SkipInCI")]
5958
public void MatrixFactorizationSimpleTrainAndPredict()
6059
{
6160
var mlContext = new MLContext(seed: 1);
@@ -94,13 +93,13 @@ public void MatrixFactorizationSimpleTrainAndPredict()
9493
var rightMatrix = model.Model.RightFactorMatrix;
9594
Assert.Equal(leftMatrix.Count, model.Model.NumberOfRows * model.Model.ApproximationRank);
9695
Assert.Equal(rightMatrix.Count, model.Model.NumberOfColumns * model.Model.ApproximationRank);
97-
// MF produce different matrices on different platforms, so at least test their content on windows.
96+
// MF produce different matrices on different platforms, so check their content on Windows.
9897
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
9998
{
100-
Assert.Equal(0.33491, leftMatrix[0], 5);
101-
Assert.Equal(0.571346991, leftMatrix[leftMatrix.Count - 1], 5);
102-
Assert.Equal(0.2433036714792256, rightMatrix[0], 5);
103-
Assert.Equal(0.381277978420258, rightMatrix[rightMatrix.Count - 1], 5);
99+
Assert.Equal(0.301269173622131, leftMatrix[0], 5);
100+
Assert.Equal(0.558746933937073, leftMatrix[leftMatrix.Count - 1], 5);
101+
Assert.Equal(0.27028301358223, rightMatrix[0], 5);
102+
Assert.Equal(0.390790820121765, rightMatrix[rightMatrix.Count - 1], 5);
104103
}
105104
// Read the test data set as an IDataView
106105
var testData = reader.Load(new MultiFileSource(GetDataPath(TestDatasets.trivialMatrixFactorization.testFilename)));
@@ -124,12 +123,14 @@ public void MatrixFactorizationSimpleTrainAndPredict()
124123
var metrices = mlContext.Recommendation().Evaluate(prediction, labelColumnName: labelColumnName, scoreColumnName: scoreColumnName);
125124

126125
// Determine if the selected metric is reasonable for different platforms
127-
double tolerance = Math.Pow(10, -7);
126+
// Windows tolerance is set at 1e-7, and Linux tolerance is set at 1e-5
127+
double windowsTolerance = Math.Pow(10, -7);
128+
double linuxTolerance = Math.Pow(10, -5);
128129
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
129130
{
130131
// Linux case
131-
var expectedUnixL2Error = 0.614457914950479; // Linux baseline
132-
Assert.InRange(metrices.MeanSquaredError, expectedUnixL2Error - tolerance, expectedUnixL2Error + tolerance);
132+
var expectedUnixL2Error = 0.612974867782832; // Linux baseline
133+
Assert.InRange(metrices.MeanSquaredError, expectedUnixL2Error - linuxTolerance, expectedUnixL2Error + linuxTolerance);
133134
}
134135
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
135136
{
@@ -141,8 +142,8 @@ public void MatrixFactorizationSimpleTrainAndPredict()
141142
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
142143
{
143144
// Windows case
144-
var expectedWindowsL2Error = 0.6098110249191965; // Windows baseline
145-
Assert.InRange(metrices.MeanSquaredError, expectedWindowsL2Error - tolerance, expectedWindowsL2Error + tolerance);
145+
var expectedWindowsL2Error = 0.622283290742721; // Windows baseline
146+
Assert.InRange(metrices.MeanSquaredError, expectedWindowsL2Error - windowsTolerance, expectedWindowsL2Error + windowsTolerance);
146147
}
147148

148149
var modelWithValidation = pipeline.Fit(data, testData);

0 commit comments

Comments
 (0)