Skip to content Skip to sidebar Skip to footer

Scikit Learn - Valueerror: Operands Could Not Be Broadcast Together

I'm trying to apply Gaussian Naive Bayes model on a dataset to predict disease. It's running correctly when I'm predicting using training data, but when I'm trying to predict using

Solution 1:

I found the bug. The error is occurring because of Imputer. Imputer replaces the missing value in data set. But, if any column is entirely composed of missing value then it deletes that column. I had a column full of missing data entirely in testing data set. So, Imputer was deleting that and thus shape didn't match with training data and that's the reason of the error. Just removed the column name from feature_columns list which was full of missing value and it worked.


Post a Comment for "Scikit Learn - Valueerror: Operands Could Not Be Broadcast Together"