Skip to content

Instantly share code, notes, and snippets.

@jetnew
Last active June 1, 2019 18:30
Show Gist options
  • Save jetnew/667674250457641c0fe37f06252394dc to your computer and use it in GitHub Desktop.
Save jetnew/667674250457641c0fe37f06252394dc to your computer and use it in GitHub Desktop.
Decision Tree using scikit-learn
from sklearn.tree import DecisionTreeClassifier
from sklearn.model_selection import train_test_split
from sklearn.metrics import classification_report
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.20, shuffle=True)
clf = DecisionTreeClassifier()
clf.fit(X_train, y_train)
y_pred = clf.predict(X_test)
print(classification_report(y_test, y_pred))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment