Question: ValueError: Input contains NaN, infinity or a value too large for dtype('float32') From this following code : #importing panda and numpy library and using Skicit-Learn
From this following code :
#importing panda and numpy library and using Skicit-Learn
import numpy as np
import pandas as pd
from sklearn.tree import DecisionTreeClassifier
from sklearn import metrics
With the dataset that i already obtained and after that, i try to :
#creating a Decision tree and fitting it using dataset of train
classifier = DecisionTreeClassifier()
classifier.fit(X_train, y_train)
#creating a Decision tree and fitting it using dataset of train
classifier = DecisionTreeClassifier()
classifier.fit(X_train, y_train)
2. and get this following error too :
This DecisionTreeClassifier instance is not fitted yet. Call 'fit' with appropriate arguments before using this estimator.
with this following code :
#predicting the target column of the test dataset
y_pred = classifier.predict(X_test)
Both error are in the same phyton notebook .
Subject : Phyton
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
