决策树之scikit-learn

实例

python 复制代码
from sklearn.datasets import load_iris
from sklearn import tree
import matplotlib.pyplot as plt

# Load iris dataset
iris = load_iris()
X, y = iris.data, iris.target

# Fit the classifier
clf = tree.DecisionTreeClassifier()
clf = clf.fit(X, y)

# Plot the decision tree
plt.figure(figsize=(15, 10))
tree.plot_tree(clf)
plt.show()
相关推荐
mikuyyds11 分钟前
geo-toolbox 水文插件算法解析:从 Muskingum 到 Muskingum-Cunge
算法·rust·gis
Omics Pro23 分钟前
斯坦福Nature+Science|广义虚拟细胞基础大模型
数据库·人工智能·算法·机器学习·自然语言处理
代数狂人25 分钟前
机器学习数学基础──从零开始 导读
人工智能·算法
Zane19941 小时前
暴力字符串匹配失配就要把文本指针往回拉,KMP凭什么能让它一直往前走
算法
Tim_102 小时前
【LeetCode】338、比特位计数
c++·算法·leetcode
木子算法2 小时前
不是重心也不是中点:费马—韦伯点、它的最优性条件与迭代求解
人工智能·算法·目标跟踪
tryxr3 小时前
矩阵的几种基础变换
java·数据结构·算法·矩阵
mmmmath_33 小时前
LeetCode.028.找出字符串中第一个匹配项的
数据结构·算法·leetcode
Selvaggia4 小时前
DMD(Distribution Matching Distillation,分布匹配蒸馏)
算法
Navigator_Z4 小时前
LeetCode //C - 1255. Maximum Score Words Formed by Letters
c语言·算法·leetcode