Skip to content
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

ValueError: Supported target types are: ('binary', 'multiclass'). Got 'unknown' instead. #2

Closed
aminzadenoori opened this issue Oct 14, 2019 · 5 comments

Comments

@aminzadenoori
Copy link

Hi,
when I want to run "train.py --v lstm" I have this error, ValueError: Supported target types are: ('binary', 'multiclass'). Got 'unknown' instead.
can you guide me on how to fix it?
thank you.

@aminzadenoori
Copy link
Author

I solved that by:

from sklearn.preprocessing import LabelEncoder

label_encoder = LabelEncoder()
y = label_encoder.fit_transform(target_labels)

@mahmoudaghvami
Copy link

mahmoudaghvami commented Oct 14, 2022

I found the same error.
the line 38 of train.py raise the error
line 38 for train, test in kfold.split(X, Y)
The error ValueError: Supported target types are: ('binary', 'multiclass'). Got 'unknown'

apprently Y is unknown

the fix by [aminzadenoori] does not work for me.
How to fix it?
@danielelic @aminzadenoori

@zendra123
Copy link

Hi @mahmoudaghvami I have the same error, have you found any solution, how to fix this?

@xiaoluobie
Copy link

I had the same problem:ValueError: Supported target types are: (‘binary‘, ‘multiclass‘). Got ‘unknown‘ instead.”, and now it's over.

You can try adding a code: y = y.ype (float) in front of this line of code:for fold_num, (train_index, test_index) in enumerate(skf.split(X, y)):

See my blog for detailed solutions and reasons.The CSDN address link is:
CSDN

I hope this is helpful
@mahmoudaghvami @zendra123

@zendra123
Copy link

@xiaoluobie thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants