sepl = input("Sepal Length:") sepw = input("Sepal width:") petl = input("Petal Length:") petw = input("Petal width:") pr = dec.predict(np.column_stack([sepl, sepw, petl, petw])) print('Predicted Species is : ', pr) import os os.environ["path"] = "c:/Program files(x86)/Graphvz2.38/bin" from sklearn.externals.six import StringIO from IPython.display import Image from sklearn.tree import export_graphviz import pydotplus dot_data = StringIO() feat_col = ['Sepal length', 'Sepal width', 'Petal length', 'Petal width'] export_graphviz(dec, out_file=dot_data, filled=True, rounded=True, special_characters=True, feature_name=feat_col, class_name=['Setosa', 'Versicolor', 'Virginica']) graph = pydotplus.graph_from_dot_data(dot_data.getvalues()) graph.write_png('iris.png') Image(graph.create_png())