决策树之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()
相关推荐
波力海苔夹心脆6751 小时前
VisionPro 与 VisionMaster 对比(上):软件定位、开发环境与核心视觉工具对照
图像处理·算法·计算机视觉·c#·视觉检测·个人开发·vp9
动词ing2 小时前
【题目练习】盛最多水的容器
算法·目标检测
海绵宝宝转agent2 小时前
2026-10-14算法+面经总结
java·笔记·算法·缓存
虚无的纽扣2 小时前
【力扣刷题】第四天:三数之和、四数之和
算法·leetcode·职场和发展
ZiLing2 小时前
2026 ROS 2 Lyrical 工程实例(一):从零搭建 AMR 激光 SLAM——Gazebo、slam_toolbox 与 Nav2 全链路跑通
算法
巴糖2 小时前
为什么你的大模型总在胡说八道?—— top_k /top_p/temperature 调参实战手册
算法
rou2 小时前
LeetCode410.分割数组的最大值
算法
垆边人似月.2 小时前
华为题:字符串中最长连续数字串
开发语言·c++·算法
_不会dp不改名_2 小时前
leetcode_3273 数位平方和的最大值
算法·leetcode·职场和发展
vivo互联网技术2 小时前
SSR-Merge:把 LoRA 合并从"参数算术"变成"信号路由" | ICML 2026
人工智能·算法·计算机视觉