reshaping codes

This commit is contained in:
mhjensen
2019-10-27 21:13:33 +01:00
parent ee9d5cfa10
commit f77fcea03c
11 changed files with 1075 additions and 0 deletions
+28
View File
@@ -0,0 +1,28 @@
# Common imports
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.tree import DecisionTreeClassifier
from sklearn.datasets import make_moons
from sklearn.tree import export_graphviz
from pydot import graph_from_dot_data
import pandas as pd
np.random.seed(42)
X, y = make_moons(n_samples=100, noise=0.25, random_state=53)
X_train, X_test, y_train, y_test = train_test_split(X,y,random_state=0)
tree_clf = DecisionTreeClassifier(max_depth=5)
tree_clf.fit(X_train, y_train)
export_graphviz(
tree_clf,
out_file="moons.dot",
# feature_names=tree_clf.feature_names,
# class_names=tree_clf.target_names,
rounded=True,
filled=True
)