chemprop / chemprop

Message Passing Neural Networks for Molecule Property Prediction
https://chemprop.csail.mit.edu
Other
1.79k stars 587 forks source link

[v2 BUG]: "RuntimeError: Detected the following values in `target`" during binary classification #954

Closed isabelg-arcia closed 4 months ago

isabelg-arcia commented 4 months ago

Describe the bug I'm having a runtimeError problem when running the training cell. I'm using a dataset whose target is binary. splitting randomly.

I'm not sure if this is a bug, but I was able to run this same dataset and parameters normally before.

I am runnig the "training.ipynb" script.

The error occurs on line " trainer.fit(mpnn, train_loader, val_loader)"

Captura de tela 2024-07-03 122607

Environment

kevingreenman commented 4 months ago

@isabelg-arcia the error seems to suggest that your dataset is multi-class with 13 classes rather than binary. Can you double check your data file, or try to reproduce the issue with one of our datasets in tests/data/?

isabelg-arcia commented 4 months ago

@kevingreenman Thank you for your returning. I did some tests and observed that this error occurs when we use the ROC and PRC metrics to train the model.

I am using binary classification and my data set consists of a smile column and another with 0 and 1 indicating activity.

The tests on your dataset are working normally.

kevingreenman commented 4 months ago

@isabelg-arcia thanks for the additional info! Could you provide a minimal working example of the data file and the script you're using so I can try to reproduce it?

kevingreenman commented 4 months ago

@isabelg-arcia I got your reply by email but don't see it on the web here anymore for some reason. Your test file only has 1's and 0's as targets, except for the final line, which has no target value. This is causing chemprop to read the final SMILES string as one of the targets, so the unique characters in that string plus the 1's and 0's from the other targets make 13 unique characters (0123CONScn()=), hence the error message you're seeing. If you add a target value to that last line, your error should go away.

I'll close this issue for now, but feel free to reopen if this doesn't resolve your problem or if you have additional questions.