Hi,
I'm not able to fit the training data into a decision tree model. Below is the error I obtain after attempting to do it:
ValueError: Input contains NaN, infinity or a value too large for dtype('float32').
Could someone please help me out with this issue? Thank you.
I'm a beginner in python…but came across this issue before…
The experience was I was using MLPClassifier to predict currrency prices( solved it by using MLPRegressor as classification models only accepts 'int' not 'float')
OR
—Imputer???
OR
—X_train = new.iloc[:,2:].values
y_train = new.iloc[:,1].values
y_train = y_train.astype('float')
OR
X_train = new.iloc[:,2:].values
y_train = new.iloc[:,1].values
y_train = y_train.astype('int')
(Not an expert,hope these helps…)
Hi Sean,
This error could possibly be because of missing values in the dataset. You can drop the missing values from the dataset and try fitting the model again. You can use df.dropna() to drop the missing values.
Hope this would help you!