决策树之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()
相关推荐
Code_Solitude29 分钟前
c语言:期末复习5(二维数组)
c语言·数据结构·算法
CV爱数码37 分钟前
论文精读|DC-PnPDP(ICML 2026):给即插即用扩散先验加回 ADMM 的对偶变量
人工智能·深度学习·算法·3d·ct
电科_银尘39 分钟前
【大模型算法与工程 52】检索优化:混合召回、重排与查询改写
人工智能·算法·机器学习
猿人谷1 小时前
Pareto:为什么真正的优化,不是寻找一个最优解?
后端·算法·aigc
cooldream20091 小时前
计算机专业本科毕业设计系列07——类型④:算法与理论研究
算法·毕业设计·计算机专业·课程设计
劲夫学编程1 小时前
leetcode: 字母异位词分组
算法·leetcode
wy_hhxx2 小时前
[Leetcode] 动态规划(打家劫舍、0-1背包、完全背包)
算法·leetcode·动态规划·完全背包·0-1背包
m0_547486663 小时前
《智能计算》全套课件PDF(武汉工程大学)
算法·贝叶斯算法·智能计算
weixin_307779133 小时前
Jupyter SQL 表血缘分析并导出 Excel
开发语言·python·sql·算法·excel
Lazyafei3 小时前
560. 和为 K 的子数组
数据结构·算法