Leo followed Machine Learning: Decision Trees sklearn of

sklearn framework

Here Insert Picture Description

Mapping function

Here Insert Picture Description

1.10. Decision Trees

1.10.1. Classification

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

1.10.2. Regression

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]])

source address

https://scikit-learn.org/stable/modules/tree.html

Published 17 original articles · won praise 0 · Views 136

Guess you like

Origin blog.csdn.net/weixin_39025679/article/details/104475860