text_html_output_1.png
from IPython.display import Image

import os

import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

import pydotplus

import seaborn as sns # plotting

data = pd.read_csv('../input/Iris.csv')

data.drop('Id', axis=1).corr()

feature_columns = ['SepalLengthCm', 'SepalWidthCm', 'PetalLengthCm', 'PetalWidthCm']
X = data[feature_columns]
y = data['Species']

X.corr()

clf = tree.DecisionTreeClassifier()
clf = clf.fit(X, y)

with open('iris.dot', 'w') as f:
    f = tree.export_graphviz(clf, out_file=f)
import os
os.unlink('iris.dot')
import pydotplus
dot_data = tree.export_graphviz(clf, out_file=None)
graph = pydotplus.graph_from_dot_data(dot_data)
graph.write_pdf('iris.pdf')
from IPython.display import Image
dot_data = tree.export_graphviz(clf, out_file=None, feature_names=X.columns, class_names=['setosa', 'versicolor', 'virginica'], filled=True, rounded=True, special_characters=True)
graph = pydotplus.graph_from_dot_data(dot_data)
Image(graph.create_png())