Skip to content

Commit 4f18e9a

Browse files
committed
Test NaN replacement and fix build for core30 and x86
1 parent 61da88d commit 4f18e9a

File tree

2 files changed

+50
-6
lines changed

2 files changed

+50
-6
lines changed

test/BaselineOutput/Common/Onnx/BinaryClassification/BreastCancer/OneHotBagPipeline.txt

Lines changed: 47 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,34 @@
103103
},
104104
{
105105
"input": [
106-
"F1",
107106
"F21"
108107
],
108+
"output": [
109+
"F22"
110+
],
111+
"name": "Imputer",
112+
"opType": "Imputer",
113+
"attribute": [
114+
{
115+
"name": "replaced_value_float",
116+
"f": "NaN",
117+
"type": "FLOAT"
118+
},
119+
{
120+
"name": "imputed_value_floats",
121+
"floats": [
122+
0
123+
],
124+
"type": "FLOATS"
125+
}
126+
],
127+
"domain": "ai.onnx.ml"
128+
},
129+
{
130+
"input": [
131+
"F1",
132+
"F22"
133+
],
109134
"output": [
110135
"Features"
111136
],
@@ -334,10 +359,10 @@
334359
},
335360
{
336361
"input": [
337-
"F21"
362+
"F22"
338363
],
339364
"output": [
340-
"F22"
365+
"F23"
341366
],
342367
"name": "Identity1",
343368
"opType": "Identity"
@@ -478,7 +503,7 @@
478503
}
479504
},
480505
{
481-
"name": "F22",
506+
"name": "F23",
482507
"type": {
483508
"tensorType": {
484509
"elemType": "FLOAT",
@@ -605,6 +630,24 @@
605630
}
606631
}
607632
},
633+
{
634+
"name": "F22",
635+
"type": {
636+
"tensorType": {
637+
"elemType": "FLOAT",
638+
"shape": {
639+
"dim": [
640+
{
641+
"dimValue": "1"
642+
},
643+
{
644+
"dimValue": "10"
645+
}
646+
]
647+
}
648+
}
649+
}
650+
},
608651
{
609652
"name": "Features",
610653
"type": {

test/Microsoft.ML.Tests/OnnxConversionTest.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public void SimpleEndToEndOnnxConversionTest()
7474
var onnxResult = onnxTransformer.Transform(data);
7575

7676
// Step 4: Compare ONNX and ML.NET results.
77-
CompareSelectedR4ScalarColumns("Score", "Score0", transformedData, onnxResult, 2);
77+
CompareSelectedR4ScalarColumns("Score", "Score0", transformedData, onnxResult, 1);
7878
}
7979

8080
// Step 5: Check ONNX model's text format. This test will be not necessary if Step 3 and Step 4 can run on Linux and
@@ -180,6 +180,7 @@ public void KeyToVectorWithBagOnnxConversionTest()
180180
separatorChar: '\t');
181181

182182
var pipeline = mlContext.Transforms.Categorical.OneHotEncoding("F2", "F2", Transforms.Categorical.OneHotEncodingTransformer.OutputKind.Bag)
183+
.Append(mlContext.Transforms.ReplaceMissingValues(new MissingValueReplacingTransformer.ColumnInfo("F2")))
183184
.Append(mlContext.Transforms.Concatenate("Features", "F1", "F2"))
184185
.Append(mlContext.BinaryClassification.Trainers.FastTree(labelColumn: "Label", featureColumn: "Features", numLeaves: 2, numTrees: 1, minDatapointsInLeaves: 2));
185186

@@ -299,7 +300,7 @@ public void LogisticRegressionSaveModelToOnnxTest()
299300
Done();
300301
}
301302

302-
[Fact]
303+
[ConditionalFact(typeof(Environment), nameof(Environment.Is64BitProcess))] // LightGBM is 64-bit only
303304
public void LightGbmBinaryClassificationOnnxConversionTest()
304305
{
305306
// Step 1: Create and train a ML.NET pipeline.

0 commit comments

Comments
 (0)