Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Microsoft.ML.Recommender/MatrixFactorizationTrainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ private MatrixFactorizationModelParameters TrainCore(IChannel ch, RoleMappedData

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

Expand Down
2 changes: 0 additions & 2 deletions test/Microsoft.ML.Core.Tests/UnitTests/TestEntryPoints.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2124,7 +2124,6 @@ public void EntryPointMulticlassPipelineEnsemble()

[LessThanNetCore30OrNotNetCoreFact("netcoreapp3.0 output differs from Baseline")]
//Skipping test temporarily. This test will be re-enabled once the cause of failures has been determined
Comment thread
mstfbl marked this conversation as resolved.
[Trait("Category", "SkipInCI")]
public void EntryPointPipelineEnsembleGetSummary()
{
var dataPath = GetDataPath("breast-cancer-withheader.txt");
Expand Down Expand Up @@ -6194,7 +6193,6 @@ public void TestOvaMacro()

[Fact]
//Skipping test temporarily. This test will be re-enabled once the cause of failures has been determined
[Trait("Category", "SkipInCI")]
public void TestOvaMacroWithUncalibratedLearner()
{
var dataPath = GetDataPath(@"iris.txt");
Expand Down
1 change: 0 additions & 1 deletion test/Microsoft.ML.Predictor.Tests/TestPredictors.cs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,6 @@ public void MulticlassSdcaTest()
[TestCategory("Logistic Regression")]
[TestCategory("FastTree")]
//Skipping test temporarily. This test will be re-enabled once the cause of failures has been determined
[Trait("Category", "SkipInCI")]
public void MulticlassTreeFeaturizedLRTest()
{
RunMTAThread(() =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ public void MatrixFactorization_Estimator()

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

// Determine if the selected metric is reasonable for different platforms
double tolerance = Math.Pow(10, -7);
// Windows tolerance is set at 1e-7, and Linux tolerance is set at 1e-5
double windowsTolerance = Math.Pow(10, -7);
double linuxTolerance = Math.Pow(10, -5);
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
// Linux case
var expectedUnixL2Error = 0.614457914950479; // Linux baseline
Assert.InRange(metrices.MeanSquaredError, expectedUnixL2Error - tolerance, expectedUnixL2Error + tolerance);
var expectedUnixL2Error = 0.612974867782832; // Linux baseline
Assert.InRange(metrices.MeanSquaredError, expectedUnixL2Error - linuxTolerance, expectedUnixL2Error + linuxTolerance);
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
Expand All @@ -141,8 +142,8 @@ public void MatrixFactorizationSimpleTrainAndPredict()
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
// Windows case
var expectedWindowsL2Error = 0.6098110249191965; // Windows baseline
Assert.InRange(metrices.MeanSquaredError, expectedWindowsL2Error - tolerance, expectedWindowsL2Error + tolerance);
var expectedWindowsL2Error = 0.622283290742721; // Windows baseline
Assert.InRange(metrices.MeanSquaredError, expectedWindowsL2Error - windowsTolerance, expectedWindowsL2Error + windowsTolerance);
}

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