-
Notifications
You must be signed in to change notification settings - Fork 1.9k
OneVsAllClassifier fits two trainers for binary classification task #3933
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
So you're saying that if the number of classes is 2, OneVersusAllTrainer should only produce one binary classifier? |
yeah, I don't think it should be necessary to train 2 binary classifiers, one for each of the classes, when a single one would do the trick. Right? |
From the perspective you pointed out, yes. On the other hand, the model trained by OVA is a list of model, if we follow your suggestion ML.NET will end up with
It looks a bit wired because the index Inspired by your comment, if there are only two classes, ML.NET can internally train a binary classifier and copy it to |
As long as there shouldn't be 2 trainings involved, then it should be fine. The public API should remain same. I wanna avoid having to go through the dataset to figure out how many classes are there to choose between a straight BinaryClassifier or a OneVsRest (which will again go through the dataset to determine number of classes). If going with training a single model and storing it within OutputModel[0] and OutputModel[1], can those 2 models be exactly the same or does one need to be inverse of the first one? |
The later one should have |
Now I feel doing one binary classification is better than copying the weights. |
System information
Issue
I expected OneVsAll to identify there are only two classes and train a single learner.
Source code / logs
Internally the OneVersusAllTrainer will always instantiate as many binary classifiers as the number of classes. This is inefficient for binary classification, as just a single trainer is needed. I understand that I can just use an out of the box binary classification for this, but it will simplify the usage.
The text was updated successfully, but these errors were encountered: