Possible mixup in metrics for binary classification (leads to wrong model selected)

Open
#3,046 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
machine-learning

Research direction

Start by reproducing the data-classification scenario in Model Builder with two categorical classes and Macro-Accuracy optimization, then compare the reported metrics and selected algorithm across binary and multiclass variants. Done means the metric behavior is verified and corrected consistently, with the expected warning behavior addressed if the issue’s proposed case is confirmed.

Written by the indexing model from the issue text.

Description

System Information (please complete the following information):

  • Model Builder Version (available in Manage Extensions dialog): 17.19.2.211501
  • Visual Studio Version 2022

Describe the bug
Training a multi-category model with just a 2 classes with Macro-Accuracy optimization metric.

I get:
46 FastTreeOva 0.5500 1.2160 |
|47 FastTreeOva 0.5259 1.1710 |
|6 LightGbmBinary 0.6117 1586.0270 |
|17 LightGbmMulti 0.5003 560.4780 |
|7 SdcaLogisticRegressionBinary 0.6583 2.0900 |
|18 FastTreeOva 0.5179 1.3650 |
|19 FastTreeOva 0.5097 1.0210 |
|8 LbfgsLogisticRegressionBinary 0.6583 1.5410 |
|20 FastTreeOva 0.4868 1.2010 |

LbfgsLogisticRegressionBinary gets selected, but it is exactly at the null accuracy 0.658287% for the most common category so my suspect it is just selecting true every time. If that is the case, then macro-accuracy should be 0.5%. I believe that is true, because the multiclass algorithms have much lower metrics.

Although I haven't confirmed the issue, I think the fact that binary variants report much higher accuracy point to the possibility of calculating the metric differently.

To Reproduce

  1. Scenario: data classification
  2. Set label to categorical . Make sure Boolean is not selected as type, but it just has 2 categories. For example, set 1/0 to numeric, true/false to text so binary algorithm variants will activated
  3. Train

Expected behavior
Use macro-accuracy / balanced accuracy as the metric for all algorithms.

Ideally, in binary classification we should also see macro accuracy, or at least warning if it is exactly at null accuracy or always predicting one label.

Dominant language
Dockerfile
Stars
285
Forks
66
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from dotnet/machinelearning-modelbuilder

All issues in dotnet/machinelearning-modelbuilder

Similar issues

More Machine Learning issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.