决策树之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()
相关推荐
CQU_JIAKE22 分钟前
8.23【A】
算法
sprlightning33 分钟前
LHDC V5 算法深度解析
算法·fft·lhdcv5·imdct·mdct·rice·fac
智购科技无人售货机厂家1 小时前
2026自动售货机远程运维平台设计:从设备诊断到预测性维护的工程实践~YH
运维·python·物联网·架构·django·scikit-learn
csdn_aspnet1 小时前
C# 第k个最小元素(K’th Smallest Element)
算法·c#·排序算法
BioRunYiXue1 小时前
RACE技术全攻略:从全长克隆到靶基因验证
java·javascript·网络·人工智能·科技·算法·eclipse
ZPC82102 小时前
joy 及sensor_msgs
算法
Three_ST2 小时前
沐神-动手学习深度学习-习题答案4.4模型选择,欠拟合,过拟合
人工智能·python·深度学习·学习·算法
CIO_Alliance2 小时前
AI深度系列(2)| CNN卷积池化感受野原理:从局部感知到全局视野
人工智能·深度学习·线性代数·算法·计算机视觉·企业ai转型·企业cio联盟
探物 AI2 小时前
机器人清理墙角蜘蛛网,背后需要哪些算法?——从视觉分割到贴墙力控
算法·机器人
青 春 记 忆2 小时前
LeetCode 226. 翻转二叉树|Python 解法详解
python·算法·leetcode