“Algoritma Pohon Keputusan” Kode Jawaban

pohon keputusan

# Create Decision Tree classifer object
clf = DecisionTreeClassifier(criterion="entropy", max_depth=3)

# Train Decision Tree Classifer
clf = clf.fit(X_train,y_train)

#Predict the response for test dataset
y_pred = clf.predict(X_test)

# Model Accuracy, how often is the classifier correct?
print("Accuracy:",metrics.accuracy_score(y_test, y_pred))
Ruben Visser

Pohon keputusan

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

Algoritma Pohon Keputusan

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)
Tame Tern

Jawaban yang mirip dengan “Algoritma Pohon Keputusan”

Pertanyaan yang mirip dengan “Algoritma Pohon Keputusan”

Lebih banyak jawaban terkait untuk “Algoritma Pohon Keputusan” di Python

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya