mlcommons / GaNDLF

A generalizable application framework for segmentation, regression, and classification using PyTorch
https://gandlf.org
Apache License 2.0
150 stars 78 forks source link

[BUG] Trying to train a model for classification gives a weird warning #848

Closed sarthakpati closed 3 weeks ago

sarthakpati commented 3 months ago

Describe the bug

When trying to train any classification model (and this is most prevalent for binary classification), the following UserWarning from sklearn pops up at every step per subject: y_pred contains classes not in y_true.

To Reproduce

Steps to reproduce the behavior:

  1. Use any data for binary classification (TIL, EGFR, ...).
  2. Try to train.
  3. See the following warnings:
    
    The ``converters`` are currently experimental. It may not support operations including (but not limited to) Functions in ``torch.nn.functional`` that involved data dimension

[SNIP!]


Starting validation :


C:\Projects\GaNDLF\venv\Lib\site-packages\sklearn\metrics_classification.py:2399: UserWarning: y_pred contains classes not in y_true warnings.warn("y_pred contains classes not in y_true")


The first warning comes from [this line](https://github.com/M3DV/ACSConv/blob/95dc860a77e309f010a3d8be1f675e77c7dfeda4/acsconv/converters/__init__.py#L6).

### Expected behavior
This warning should come up just once.

### Media
N.A.

### Environment information
<!-- Put the output of the following command:
python ./gandlf_debugInfo
-->
```powershell
GANDLF version: 0.0.20-dev
Git hash: 000ea17ecd2e018dafa2ecfe7a85c030bb4a02cb
Platform: Windows-10-10.0.22631-SP0
Machine: AMD64
Processor: Intel64 Family 6 Model 165 Stepping 2, GenuineIntel
Architecture: 64bit WindowsPE
Python environment:
  Version: 3.11.6
  Implementation: CPython
  Compiler: MSC v.1935 64 bit (AMD64)
  Build: main Oct  3 2023 10:29:11

Additional context

N.A.

github-actions[bot] commented 1 month ago

Stale issue message