Last active
March 30, 2016 20:38
-
-
Save monspo1/23e9b201ca361a436dcb610360a9578e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# (1) Fit a decision tree model on the training set with the default setting. | |
from sklearn import tree | |
import sklearn.grid_search as gs | |
tree_model = tree.DecisionTreeClassifier() | |
tree_model.fit(x_train, y_train) | |
grid_para_tree = {'criterion': ['gini', 'entropy'], 'max_depth': range(1, 11)} | |
grid_search_tree = gs.GridSearchCV(tree_model, grid_para_tree, cv=5, scoring='logloss') | |
grid_search_tree.fit(x_train, y_train) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment