首页 > 解决方案 > 在python中限制pdp图的轴范围

问题描述

我想在 Python 中为我的数据集生成 PDP 图。我正在使用 GradientBoostingClassifier 和数据集。

我得到的图对于每个元素都有不同的 Y 轴比例。我想将 Y 轴范围的限制设置在 0 和 1 之间。如何在 python 中实现这一点。下面是附图。

在此处输入图像描述

标签: pythonmatplotlibplot

解决方案


在此之前执行以下操作plt.show()

plt.ylim(0, 1)

其中plt由 定义import matplotlib.pyplot as plt


推荐阅读