技术栈

决策树之scikit-learn

奋进的大脑袋2024-02-07 10:54

实例

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()
上一篇:docker部署GitLab
下一篇:政安晨:机器学习快速入门(四){pandas与scikit-learn} {随机森林}
相关推荐
helloworldandy
8 小时前
高性能图像处理库
开发语言·c++·算法
2401_83656318
8 小时前
C++中的枚举类高级用法
开发语言·c++·算法
bantinghy
8 小时前
Nginx基础加权轮询负载均衡算法
服务器·算法·nginx·负载均衡
chao189844
8 小时前
矢量拟合算法在网络参数有理式拟合中的应用
开发语言·算法
代码无bug抓狂人
8 小时前
动态规划(附带入门例题)
c语言·算法·动态规划
weixin_44540230
9 小时前
C++中的命令模式变体
开发语言·c++·算法
季明洵
9 小时前
C语言实现顺序表
数据结构·算法·c·顺序表
Hgfdsaqwr
9 小时前
实时控制系统优化
开发语言·c++·算法
2301_82136961
9 小时前
嵌入式实时C++编程
开发语言·c++·算法
sjjhd652
9 小时前
多核并行计算优化
开发语言·c++·算法
热门推荐
01GitHub 镜像站点02Clawdbot 中文汉化版 接入微信、飞书03OpenCode 入门教程:介绍 · 安装 · 配置第三方 API (如 Claude)042026数学建模美赛题目特点与选题建议,常用四大模型汇总05UV安装并设置国内源062026美赛A题智能手机电池续航时间预测的连续时间数学模型07在Trae中使用Pencil MCP08Claude Code Skills 实用使用手册09Linux下V2Ray安装配置指南10一种新的LCA算法