【Sklearn】tree.export_graphviz 可视化函数

本文详细介绍了如何利用Python的Sklearn库中的tree.export_graphviz函数,将训练好的决策树模型转化为可视化图形。通过实例,展示了参数设置及图形导出过程,帮助读者更好地理解和解释决策树模型的决策规则。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Parameters:

decision_tree : decision tree regressor or classifier

The decision tree to be exported to GraphViz.

out_file : file object or string, optional (default=None)

Handle or name of the output file. If None, the result is returned as a string.

Changed in version 0.20: Default of out_file changed from “tree.dot” to None.

max_depth : int, optional (default=None)

The maximum depth of the representation. If None, the tree is fully generated.

feature_names : list of strings, optional (default=None)

Names of each of the features.

class_names : list of strings, bool or None, optional (default=None)

Names of each of the target classes in ascending numerical order. Only relevant for classification and not supported for

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值