Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

scikit learn decision tree

from sklearn import tree
X = [[0, 0], [1, 1]]
Y = [0, 1]
clf = tree.DecisionTreeClassifier()
clf = clf.fit(X, Y)
Comment

scikit decision tree

from sklearn import tree
X = [[0, 0], [2, 2]]
y = [0.5, 2.5]
clf = tree.DecisionTreeRegressor()
clf = clf.fit(X, y)
clf.predict([[1, 1]])
Comment

scikit decision tree

>>> from sklearn.datasets import load_iris
>>> from sklearn import tree
>>> iris = load_iris()
>>> X, y = iris.data, iris.target
>>> clf = tree.DecisionTreeClassifier()
>>> clf = clf.fit(X, y)
Comment

scikit learn decision tree

dot_data = tree.export_graphviz(clf, out_file=None, 
                     feature_names=iris.feature_names,  
                     class_names=iris.target_names,  
                     filled=True, rounded=True,  
                     special_characters=True)  
graph = graphviz.Source(dot_data)  
graph
Comment

PREVIOUS NEXT
Code Example
Python :: np.array_equal 
Python :: gpu DBSCAN python 
Python :: python switch item 
Python :: how to comment python 
Python :: How split() works in Python? 
Python :: bag of word scikit learn 
Python :: container with most water python code leetcode 
Python :: do while python using dates 
Python :: mid-point circle drawing 
Python :: open python file with read write permissions 
Python :: pandas convert hex string to int 
Python :: enumerate word python 
Python :: bitwise operators in python 
Python :: flask blueprints 
Python :: root = tk() python 3 
Python :: management command in django 
Python :: convert numpy array to HSV cv 
Python :: how to set geometry to full screen in pyqt5 
Python :: save a preprocess text 
Python :: how to split strings in python 
Python :: python if not none in one line 
Python :: add element to array list python 
Python :: pandas include nan in value_counts 
Python :: python get element by index 
Python :: function annotation 
Python :: tuple push 
Python :: python turtle 
Python :: python find oldest and newest date 
Python :: whitelist the ip address django 
Python :: use get method request html page python 
ADD CONTENT
Topic
Content
Source link
Name
2+3 =