Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

skit learn decision

from sklearn.datasets import load_iris
from sklearn.tree import DecisionTreeClassifier
from sklearn.tree import export_text
iris = load_iris()
decision_tree = DecisionTreeClassifier(random_state=0, max_depth=2)
decision_tree = decision_tree.fit(iris.data, iris.target)
r = export_text(decision_tree, feature_names=iris['feature_names'])
print(r)


Comment

skit learn decision

tree.plot_tree(clf) 
Comment

skit learn decision

clf.predict([[2., 2.]])
Comment

skit learn decision

import graphviz 
dot_data = tree.export_graphviz(clf, out_file=None) 
graph = graphviz.Source(dot_data) 
graph.render("iris") 
Comment

skit learn decision

from sklearn.datasets import load_iris
from sklearn import tree
X, y = load_iris(return_X_y=True)
clf = tree.DecisionTreeClassifier()
clf = clf.fit(X, y)
Comment

PREVIOUS NEXT
Code Example
Python :: ORing two cv mat objects 
Python :: discertize dara python 
Python :: lekht valenca poland 
Python :: how to use wbtools in python 
Python :: spark write progress bar jupyter 
Python :: get question mark from a word + python 
Python :: torch.nn.Linear(in_features, out_features, bias=True) discription 
Python :: python3 netifaces get current interface 
Python :: access matrix value opencv 
Python :: combining sparse class 
Python :: ipywidgets unobserve functools partial 
Python :: sklearn recognising sentences 
Python :: extract label from tf data 
Python :: python resample time series 
Python :: how to draw triangle in pygame 
Python :: fibonacci sequence python code 
Python :: install matplotlib on nvidia jetson nx 
Python :: add vertical line to horizontal graph 
Python :: axes turn of axis matplotlb 
Python :: Then generate Django project from the project template of cookiecutter 
Python :: pytorch rolling window 
Python :: mechanize python #12 
Python :: struct trong Python 
Python :: inline_ternary(if)_condition 
Python :: can we put the object as value in a dictionary in python* 
Python :: str vs rper in python 
Python :: average values in a list python 
Python :: turn index back to column 
Python :: Examples pandas.read_hfd5() 
Python :: foreach on sysargv 
ADD CONTENT
Topic
Content
Source link
Name
2+3 =