@@ -55,7 +55,6 @@ public void MatrixFactorization_Estimator()
55
55
56
56
[ MatrixFactorizationFact ]
57
57
//Skipping test temporarily. This test will be re-enabled once the cause of failures has been determined
58
- [ Trait ( "Category" , "SkipInCI" ) ]
59
58
public void MatrixFactorizationSimpleTrainAndPredict ( )
60
59
{
61
60
var mlContext = new MLContext ( seed : 1 ) ;
@@ -94,13 +93,13 @@ public void MatrixFactorizationSimpleTrainAndPredict()
94
93
var rightMatrix = model . Model . RightFactorMatrix ;
95
94
Assert . Equal ( leftMatrix . Count , model . Model . NumberOfRows * model . Model . ApproximationRank ) ;
96
95
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 .
98
97
if ( RuntimeInformation . IsOSPlatform ( OSPlatform . Windows ) )
99
98
{
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 ) ;
104
103
}
105
104
// Read the test data set as an IDataView
106
105
var testData = reader . Load ( new MultiFileSource ( GetDataPath ( TestDatasets . trivialMatrixFactorization . testFilename ) ) ) ;
@@ -124,12 +123,14 @@ public void MatrixFactorizationSimpleTrainAndPredict()
124
123
var metrices = mlContext . Recommendation ( ) . Evaluate ( prediction , labelColumnName : labelColumnName , scoreColumnName : scoreColumnName ) ;
125
124
126
125
// 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 ) ;
128
129
if ( RuntimeInformation . IsOSPlatform ( OSPlatform . Linux ) )
129
130
{
130
131
// 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 ) ;
133
134
}
134
135
else if ( RuntimeInformation . IsOSPlatform ( OSPlatform . OSX ) )
135
136
{
@@ -141,8 +142,8 @@ public void MatrixFactorizationSimpleTrainAndPredict()
141
142
else if ( RuntimeInformation . IsOSPlatform ( OSPlatform . Windows ) )
142
143
{
143
144
// 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 ) ;
146
147
}
147
148
148
149
var modelWithValidation = pipeline . Fit ( data , testData ) ;
0 commit comments