Skip to content

Model.ConvertToOnnx() fails for Classification pipelines if non-default Features column name is used #3089

@glebuk

Description

@glebuk

The following code fails to convert to ONNX model:

            var mlContext = new MLContext();
            var data = mlContext.Data.LoadFromEnumerable<Observation>(Data);
            var chain = mlContext.Transforms.Concatenate("FeatureVector", "Price")
                .Append(mlContext.BinaryClassification.Trainers.LogisticRegression(
                    "Label", "FeatureVector"));

            var transformer = chain.Fit(data);
            using (var stream = File.Create("foo.onnx"))
                mlContext.Model.ConvertToOnnx(transformer, data, stream);

On the other hand, if you rename "FeatureVector" to "Features" it works.
This happens for various learners and both binary and multiclass. for both calibrated and non-calibrated. This does NOT happen on regression

Metadata

Metadata

Assignees

Labels

P1Priority of the issue for triage purpose: Needs to be fixed soon.bugSomething isn't workingclassificationBugs related classification tasksonnxExporting ONNX models or loading ONNX models

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions