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
+
1
5
using System . Collections . Generic ;
2
6
using System . IO ;
3
7
using Microsoft . ML ;
@@ -10,52 +14,52 @@ namespace Microsoft.ML.Tests.TrainerEstimators
10
14
{
11
15
public partial class TrainerEstimators
12
16
{
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 ( ) ;
59
63
}
60
64
}
61
65
}
0 commit comments