当前位置: 首页 > news >正文

Python基础学习-Day32

面对一个全新的官方库,是否可以借助官方文档的写法了解其如何使用。

我们以pdpbox这个机器学习解释性库来介绍如何使用官方文档。

大多数 Python 库都会有官方文档,里面包含了函数的详细说明、用法示例以及版本兼容性信息。

通常查询方式包含以下2种:

  1. GitHub 仓库:https://github.com/SauceCat/PDPbox
  2. PyPI 页面:https://pypi.org/project/PDPbox/
  3. 官方文档:https://pdpbox.readthedocs.io/en/latest/

一般通过github仓库都可以找到对应的官方文档那个。

在官方文档中搜索函数名,然后查看函数的详细说明和用法示例。

iris = load_iris()
df = pd.DataFrame(iris.data, columns=iris.feature_names)
df['target'] = iris.target 
features = iris.feature_names  
target = 'target'X_train, X_test, y_train, y_test = train_test_split(df[features], df[target], test_size=0.2, random_state=42
)model = RandomForestClassifier(n_estimators=100, random_state=42)
model.fit(X_train, y_train)import  pdpbox
print(pdpbox.__version__)from pdpbox.info_plots import TargetPlotfeature = 'petal length (cm)'
feature_name = feature feature = 'petal length (cm)'
feature_name = feature 
)
target_plot = TargetPlot(df=df, feature=feature, feature_name=feature_name,  # target='target',target='target',  grid_type='percentile',  num_grid_points=10 target_plot.plot()
type(target_plot.plot())
len(target_plot.plot())
target_plot.plot()[0]
target_plot.plot()[2]fig, axes, summary_df = target_plot.plot(which_classes=None,  show_percentile=True,  engine='plotly',template='plotly_white'
)
)
fig.update_layout(width=800, height=500,  title=dict(text=f'Target Plot: {feature_name}', x=0.5)  fig.show()

@浙大疏锦行

http://www.xdnf.cn/news/596611.html

相关文章:

  • 计算机图形学Games101笔记--光线追踪。RTX ON!!!(<--删除线)
  • QT5.14版本加载在线地图(天地图)
  • 【C语言】复习~动态内存管理
  • LRU (Least Recently Used) 页面置换算法
  • 征程 6 J6E/M linear 双int16量化支持替代方案
  • 什么是云主机?
  • 使用行为分析和深度证据集群实时检测内部威胁
  • deepwiki-open开源项目分析
  • CVE-2022-22947源码分析与漏洞复现
  • 堆的C语言实现
  • 认识CPU (三):数据通路——CPU的煎饼物流系统
  • 汇舟问卷:国外问卷调查如何闭坑
  • 并发编程实战--对象的共享
  • java每日精进 5.22【多数据源(读写分离)、事务】
  • 01_springCloud基础知识
  • 并发编程之线程基础
  • 『VUE』vue-quill-editor 添加超链接的同时为文字添加颜色(详细图文注释)
  • 有动画效果,但动画窗格里为空
  • 红黑树插入的旋转变色
  • Python |GIF 解析与构建(1):初步解析
  • SOC-ESP32S3部分:7-如何学习ESP32S3-IDF开发
  • Katoolin3 项目介绍:在 Ubuntu 上轻松安装 Kali Linux 工具
  • 【题解-洛谷】P9644 [SNCPC2019] Turn It Off
  • 1.2V超低功耗晶振:物联网设备续航提升的秘密武器
  • ThreadLocal底层原理解析
  • 比较结构的连通性
  • MySQL多线程备份工具mysqlpump详解!
  • 骰子游戏(2023睿抗省赛)
  • C++函数封装和绑定
  • 硬件,软件和进程