I am not familiar with python and am trying to run a decision tree classifier in python using SKLEARN library and when I run the code, I encounters the error:
ValueError: Input contains NaN, infinity or a value too large for dtype('float32')
I have tried using a smaller subset of my excel datasheet and the code is able to execute with the results I want. So I suspect the problem is that my data set is too big. Here is my code that causes the crash:
df_X = data_train[['DayOfWeek', 'Promo', 'StateHoliday']]
df_Y = data_train[['Sales_band']]
X_train, X_test, y_train, y_test = train_test_split(df_X, df_Y, random_state=1)
model = tree.DecisionTreeClassifier()
model.fit(X_train, y_train) // Line that causes crash
y_predict = model.predict(X_test)
print('The accuracy of the Decision Tree is', accuracy_score(y_test, y_predict))