Skip to content

Commit 75e2337

Browse files
committed
fixes dotnet#40
1 parent cfb13e2 commit 75e2337

File tree

5 files changed

+62
-48
lines changed

5 files changed

+62
-48
lines changed

src/Microsoft.ML.OneDal/OneDalCatalog.cs

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
// See the LICENSE file in the project root for more information.
4+
15
using Microsoft.ML.Data;
26
using Microsoft.ML.Runtime;
37
using Microsoft.ML.Trainers;

src/Microsoft.ML.OneDal/Properties/AssemblyInfo.cs

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
// See the LICENSE file in the project root for more information.
4+
15
using System.Runtime.CompilerServices;
26
using Microsoft.ML;
37

test/Microsoft.ML.AutoML.Tests/UserInputValidationTests.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ public void ValidateTrainDataColumnTestMultipleMismatchLessThan5()
407407
ex.Message);
408408
}
409409
}
410-
410+
411411
[Fact]
412412
public void ValidateTrainDataColumnTestMultipleMismatchMoreThan5()
413413
{
@@ -422,6 +422,6 @@ public void ValidateTrainDataColumnTestMultipleMismatchMoreThan5()
422422
ex.Message);
423423
}
424424
}
425-
425+
426426
}
427427
}

test/Microsoft.ML.TestFramework/GlobalBase.cs

+2
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,9 @@ private static void AssertHandler(string msg, IExceptionContext ectx)
7676
}
7777
else
7878
#endif
79+
{
7980
Assert.True(false, $"Assert failed: {msg}");
81+
}
8082
}
8183

8284
public static void AssertHandlerTest()
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
// See the LICENSE file in the project root for more information.
4+
15
using System.Collections.Generic;
26
using System.IO;
37
using Microsoft.ML;
@@ -10,52 +14,52 @@ namespace Microsoft.ML.Tests.TrainerEstimators
1014
{
1115
public partial class TrainerEstimators
1216
{
13-
internal class DataPoint1
14-
{
15-
public float Label { get; set; }
16-
[VectorType(1)]
17-
public float[] Features { get; set; }
18-
}
19-
20-
internal class ScorePoint
21-
{
22-
public float Score { get; set; }
23-
}
24-
25-
// [NativeDependencyFact("OneDalImports")]
26-
[Fact]
27-
public void TestEstimatorOneDalLinReg()
28-
{
29-
List<DataPoint1> literalData = new List<DataPoint1>
30-
{
31-
new DataPoint1 { Features = new float[]{1}, Label= 39000 },
32-
new DataPoint1 { Features = new float[]{1.3F}, Label= 46200 },
33-
new DataPoint1 { Features = new float[]{1.5F}, Label= 37700 },
34-
new DataPoint1 { Features = new float[]{2}, Label= 43500 },
35-
new DataPoint1 { Features = new float[]{2.2F}, Label= 40000 },
36-
new DataPoint1 { Features = new float[]{2.9F}, Label= 56000 }
37-
};
38-
39-
var dataView = ML.Data.LoadFromEnumerable(literalData);
40-
// WL Merge Note: The LinReg is removed. Comment out this test for now.
41-
//var trainer = ML.Regression.Trainers.LinReg(labelColumnName: "Label", featureColumnName: "Features");
42-
43-
// // TestEstimatorCore(trainer, dataView);
44-
45-
//var model = trainer.Fit(dataView);
46-
//var modelParameters = ((ISingleFeaturePredictionTransformer<object>)model).Model as LinearRegressionModelParameters;
47-
// // Assert.True(model.Model.HasStatistics);
48-
// // Assert.NotEmpty(model.Model.StandardErrors);
49-
// // Assert.NotEmpty(model.Model.PValues);
50-
// // Assert.NotEmpty(model.Model.TValues);
51-
//var transferredModel = ML.Regression.Trainers.OnlineGradientDescent(numberOfIterations: 1).Fit(dataView, modelParameters);
52-
53-
//var predictionEngine = ML.Model.CreatePredictionEngine<DataPoint1, ScorePoint>(transferredModel);
54-
//var result = predictionEngine.Predict(new DataPoint1 { Features = new float[]{1.3F} });
55-
56-
// //Assert.True(File.Exists("libOneDalNative.so"));
57-
//Assert.False(trainer.Info.WantCaching);
58-
Done();
17+
internal class DataPoint1
18+
{
19+
public float Label { get; set; }
20+
[VectorType(1)]
21+
public float[] Features { get; set; }
22+
}
23+
24+
internal class ScorePoint
25+
{
26+
public float Score { get; set; }
27+
}
28+
29+
// [NativeDependencyFact("OneDalImports")]
30+
[Fact]
31+
public void TestEstimatorOneDalLinReg()
32+
{
33+
List<DataPoint1> literalData = new List<DataPoint1>
34+
{
35+
new DataPoint1 { Features = new float[]{1}, Label= 39000 },
36+
new DataPoint1 { Features = new float[]{1.3F}, Label= 46200 },
37+
new DataPoint1 { Features = new float[]{1.5F}, Label= 37700 },
38+
new DataPoint1 { Features = new float[]{2}, Label= 43500 },
39+
new DataPoint1 { Features = new float[]{2.2F}, Label= 40000 },
40+
new DataPoint1 { Features = new float[]{2.9F}, Label= 56000 }
41+
};
42+
43+
var dataView = ML.Data.LoadFromEnumerable(literalData);
44+
// WL Merge Note: The LinReg is removed. Comment out this test for now.
45+
//var trainer = ML.Regression.Trainers.LinReg(labelColumnName: "Label", featureColumnName: "Features");
46+
47+
// // TestEstimatorCore(trainer, dataView);
48+
49+
//var model = trainer.Fit(dataView);
50+
//var modelParameters = ((ISingleFeaturePredictionTransformer<object>)model).Model as LinearRegressionModelParameters;
51+
// // Assert.True(model.Model.HasStatistics);
52+
// // Assert.NotEmpty(model.Model.StandardErrors);
53+
// // Assert.NotEmpty(model.Model.PValues);
54+
// // Assert.NotEmpty(model.Model.TValues);
55+
//var transferredModel = ML.Regression.Trainers.OnlineGradientDescent(numberOfIterations: 1).Fit(dataView, modelParameters);
56+
57+
//var predictionEngine = ML.Model.CreatePredictionEngine<DataPoint1, ScorePoint>(transferredModel);
58+
//var result = predictionEngine.Predict(new DataPoint1 { Features = new float[]{1.3F} });
59+
60+
// //Assert.True(File.Exists("libOneDalNative.so"));
61+
//Assert.False(trainer.Info.WantCaching);
62+
Done();
5963
}
6064
}
6165
}

0 commit comments

Comments
 (0)