scikit decision tree classifier gini criterion

Solutions on MaxInterview for scikit decision tree classifier gini criterion by the best coders in the world

showing results for - "scikit decision tree classifier gini criterion"
Sara
24 Jul 2017
1from sklearn.tree import DecisionTreeClassifier
2from sklearn import metrics
3
4# Max depth Decision tree classifier using gini criterion 
5
6clf_gini_max = DecisionTreeClassifier(random_state=50, criterion='gini', max_depth=None)
7
8clf_gini_max = clf_gini_max.fit(X_train,Y_train)
9Y_pred = clf_gini_max.predict(X_test)
10
11training_accuracy = clf_gini_max.score(X_train,Y_train)
12testing_accuracy = clf_gini_max.score(X_test,Y_test)
13
14print(training_accuracy)
15print(testing_accuracy)