决策树之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()
相关推荐
仍然.5 分钟前
算法题目---BFS解决FloodFill算法问题
算法·宽度优先
dongf20198 分钟前
R语言决策树剪枝----泰坦尼克数据集
决策树·r语言·剪枝
dongf201914 分钟前
R语言决策树----mtcars数据集
决策树·r语言
Sirius Wu15 分钟前
MoE与Fengyu-Dense_架构对比及训练方案
人工智能·深度学习·算法·机器学习·语言模型·架构
却道天凉_好个秋16 分钟前
HEVC(一):环路滤波
人工智能·算法·计算机视觉·环路滤波
8Qi824 分钟前
LeetCode 300 & 674:最长递增子序列 vs 最长连续递增子序列
算法·leetcode·职场和发展·动态规划
sheeta199832 分钟前
LeetCode 补拙笔记 日期:2026.06.07 题目:283. 移动零
笔记·算法·leetcode
黎阳之光科技管控1 小时前
纯视觉定位赋能海关口岸 无感通关提升国门安全与效率
算法·安全
じ☆冷颜〃1 小时前
Picard–Lindelöf定理在CS中的应用:理论框架与算法基础
人工智能·经验分享·笔记·算法·机器学习
不知名的老吴1 小时前
机器学习评价之基础指标
人工智能·算法·机器学习