Skip to content

Added onnx export support for several multiclass classifiers - #4462

Merged
harishsk merged 3 commits into
dotnet:masterfrom
harishsk:multiclassonnx
Nov 25, 2019
Merged

harishsk merged 3 commits into
dotnet:masterfrom
harishsk:multiclassonnx

Conversation

@harishsk

@harishsk harishsk commented Nov 8, 2019 •

Copy link
Copy Markdown
Contributor

This PR adds Onnx export support + tests for the following multiclass classifiers:

  • LbfgsMaximumEntropyMulticlassTrainer
  • LightGbmMulticlassTrainer
  • LightGbmMulticlassTrainer with SoftMax
  • OneVersusAllTrainer
  • SdcaMaximumEntropyMulticlassTrainer
  • SdcaNonCalibratedMulticlassTrainer

There is a question marked with a REVIEW comment in the PR below. Please comment if you know of a better way to do what is done there.

@harishsk
harishsk requested a review from a team as a code owner November 8, 2019 23:35
public abstract ValueMapper<VBuffer<float>, VBuffer<float>> GetMapper();
public abstract JToken SaveAsPfa(BoundPfaContext ctx, JToken input);

public bool CanSaveOnnx(OnnxContext ctx) => Predictors.All(pred => (pred as ICanSaveOnnx)?.CanSaveOnnx(ctx) == true);

@ganik ganik Nov 19, 2019 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(pred as ICanSaveOnnx)? [](start = 79, length = 23)

What happens if it cant cast? #Resolved

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it can't cast, it will return a null. And the question mark after the ')' ensures makes it a null conditional operator and will not execute further and the overall function will return false.


In reply to: 348211703 [](ancestors = 348211703)

@codecov

codecov Bot commented Nov 20, 2019 •

Copy link
Copy Markdown

Codecov Report

❗ No coverage uploaded for pull request base (master@b7db4fa). Click here to learn what that means.
The diff coverage is 98.93%.

@@            Coverage Diff            @@
##             master    #4462   +/-   ##
=========================================
  Coverage          ?   75.01%           
=========================================
  Files             ?      908           
  Lines             ?   160800           
  Branches          ?    17371           
=========================================
  Hits              ?   120629           
  Misses            ?    35460           
  Partials          ?     4711
Flag Coverage Δ
#Debug 75.01% <98.93%> (?)
#production 70.25% <98.37%> (?)
#test 90.43% <100%> (?)
Impacted Files Coverage Δ
test/Microsoft.ML.Tests/OnnxConversionTest.cs 95.53% <100%> (ø)
...rd/MulticlassClassification/OneVersusAllTrainer.cs 80.67% <100%> (ø)
...LogisticRegression/MulticlassLogisticRegression.cs 68.06% <87.5%> (ø)

@harishsk harishsk closed this Nov 22, 2019
@harishsk harishsk reopened this Nov 22, 2019

@ganik ganik left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@harishsk
harishsk merged commit 539b8ff into dotnet:master Nov 25, 2019
@harishsk
harishsk deleted the multiclassonnx branch April 21, 2020 23:57
@ghost ghost locked as resolved and limited conversation to collaborators Mar 20, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants