Skip to content

Instantly share code, notes, and snippets.

@JasYoung315
Created April 3, 2015 13:23
Show Gist options
  • Save JasYoung315/8fe7fd58295f65957ace to your computer and use it in GitHub Desktop.
Save JasYoung315/8fe7fd58295f65957ace to your computer and use it in GitHub Desktop.
dtree = DecisionTreeClassifier(max_depth = 4)
dtree.fit(data_data, data_target)
scores = cross_validation.cross_val_score(dtree, data_data, data_target, cv=10)
print scores
print dtree.score(data_data, data_target)
from StringIO import StringIO
from inspect import getmembers
out = StringIO()
out = tree.export_graphviz(dtree, feature_names=names_of_attributes, out_file='tree_data.dot')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment