You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: test/Microsoft.ML.Tests/Transformers/NAIndicatorTests.cs
+33-9Lines changed: 33 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -2,13 +2,16 @@
2
2
// The .NET Foundation licenses this file to you under the MIT license.
3
3
// See the LICENSE file in the project root for more information.
4
4
5
+
usingMicrosoft.ML.Data;
5
6
usingMicrosoft.ML.Runtime.Api;
6
7
usingMicrosoft.ML.Runtime.Data;
7
8
usingMicrosoft.ML.Runtime.Data.IO;
8
9
usingMicrosoft.ML.Runtime.Model;
9
10
usingMicrosoft.ML.Runtime.RunTests;
10
11
usingMicrosoft.ML.Runtime.Tools;
12
+
usingSystem;
11
13
usingSystem.IO;
14
+
usingSystem.Linq;
12
15
usingXunit;
13
16
usingXunit.Abstractions;
14
17
@@ -47,20 +50,43 @@ public void NAIndicatorWorkout()
47
50
newNAIndicatorTransform.ColumnInfo("B","NAC"),
48
51
newNAIndicatorTransform.ColumnInfo("C","NAD"),
49
52
newNAIndicatorTransform.ColumnInfo("D","NAE"));
50
-
// write a simple test with one NAindicatortransform and try to inspect the columns using pete's code. might be easier!
51
-
//TestEstimatorCore(pipe, dataView);
53
+
TestEstimatorCore(pipe,dataView);
52
54
Done();
53
55
}
54
56
57
+
//[Fact]
58
+
//public void NAIndicatorSimpleWorkout()
59
+
//{
60
+
// var data = new[] {
61
+
// new TestClass() { A = 1, B = 3, C = new float[2]{ 1, 2 } , D = new double[2]{ 3,4} },
62
+
// new TestClass() { A = float.NaN, B = double.NaN, C = new float[2]{ float.NaN, float.NaN } , D = new double[2]{ double.NaN,double.NaN}},
63
+
// new TestClass() { A = float.NegativeInfinity, B = double.NegativeInfinity, C = new float[2]{ float.NegativeInfinity, float.NegativeInfinity } , D = new double[2]{ double.NegativeInfinity, double.NegativeInfinity}},
64
+
// new TestClass() { A = float.PositiveInfinity, B = double.PositiveInfinity, C = new float[2]{ float.PositiveInfinity, float.PositiveInfinity, } , D = new double[2]{ double.PositiveInfinity, double.PositiveInfinity}},
65
+
// new TestClass() { A = 2, B = 1, C = new float[2]{ 3, 4 } , D = new double[2]{ 5,6}},
66
+
// };
67
+
68
+
// var dataView = ComponentCreation.CreateDataView(Env, data);
69
+
// var pipe = new NAIndicatorEstimator(Env,
70
+
// new NAIndicatorTransform.ColumnInfo("A", "AA"));
71
+
// var transform = pipe.Fit(dataView);
72
+
// var outDataView = transform.Transform(dataView);
73
+
// var col = outDataView.GetColumn<bool>(Env, "AA").ToArray();
74
+
// // write a simple test with one NAindicatortransform and try to inspect the columns using pete's code. might be easier!
75
+
// //TestEstimatorCore(pipe, dataView);
76
+
// foreach(bool c in col)
77
+
// {
78
+
// Console.WriteLine(c.ToString());
79
+
// }
80
+
// Done();
81
+
//}
82
+
55
83
[Fact]
56
84
publicvoidNAIndicatorStatic()
57
85
{
58
86
stringdataPath=GetDataPath("breast-cancer.txt");
59
87
varreader=TextLoader.CreateReader(Env, ctx =>(
60
-
ScalarString:ctx.LoadText(1),
61
88
ScalarFloat:ctx.LoadFloat(1),
62
89
ScalarDouble:ctx.LoadDouble(1),
63
-
VectorString:ctx.LoadText(1,4),
64
90
VectorFloat:ctx.LoadFloat(1,4),
65
91
VectorDoulbe:ctx.LoadDouble(1,4)
66
92
));
@@ -71,11 +97,10 @@ public void NAIndicatorStatic()
0 commit comments