Description
The ColumnSelectingTransformer
has the ability to drop columns that aren't desired by the user. The Onnx exported model eliminates those columns from the Onnx model graph output, but this isn't enough to remove them from the output Schema
, so even if they're removed from the onnx model, those columns are still there in the output after using the ApplyOnnxModel
method. The reason for this is that the OnnxTransformer
(which is used by the ApplyOnnxModel
method) is a RowToRowTransformer
, and such transformers don't have the capacity to drop columns, only to add them to the input DataView.
Code
The existing test for ColumnSelectingTransformer can be used to notice this issue
machinelearning/test/Microsoft.ML.Tests/OnnxConversionTest.cs
Lines 1707 to 1765 in 22c7ac8
By setting a breakpoint, and inspecting into the schema of the outputs, I get the following result:
It shows that the undesired columns were correctly dropped by the ColumnSelectingTransformer
, but not by the OnnxModel
. This test should also include comparing both schemas, to make sure that the onnxmodel is actually dropping the undesired columns.