All Courses

error ValueError: y contains previously unseen labels: 44

By Manerushi149@gmail.com, 3 months ago
  • Bookmark
0

ML ValueError: y contains previously unseen labels: 44

Valueerror
Error
2 Answers
0
Hitendradixit18@gmail.com

while encoding there is some issue check your encoding part

0
Goutamp777

This error usually occurs when you are trying to fit a machine learning model with a training dataset that has labels (or classes) that are not present in the list of possible labels (or classes) that the model was trained on.

For example, if you have a classification model that was trained to predict one of three classes ('A', 'B', or 'C'), and you try to use it to predict a new sample with a label of 'D', you will get the error "ValueError: y contains previously unseen labels: 'D'".

To fix this error, you will need to either:

  1. Make sure that the labels in your training dataset are one of the classes that the model was trained on.
  2. Retrain the model on a new dataset that includes all the possible labels that you want the model to be able to predict.
  3. Use a different model that was trained on a dataset with a larger number of classes.

I hope this helps! Let me know if you have any other questions.

Your Answer

Webinars

Live Masterclass on : "How Machine Get Trained in Machine Learning?"

Mar 30th (7:00 PM) 516 Registered
More webinars

Related Discussions

Running random forest algorithm with one variable

View More