0

我想使用 Yellowbrick 可视化工具绘制预测误差,但我没有得到想要的结果。该图类似于不正确的 pp 图或 qq 图。此外,我无法更改轴的标签并添加标题,默认情况下我也无法获得任何标签和图例。谁能告诉我我该怎么做。这是可视化工具的代码:

def predict_error(model):
    visualizer = PredictionError(model)
    visualizer.fit(X_train, Y_train)  # Fit the training data to the visualizer
    visualizer.score(X_test, Y_test)  # Evaluate the model on the test data
    visualizer.show()   

这是我得到的输出:

在此处输入图像描述

4

1 回答 1

1

我们最近有一个贡献者在我们的 中添加了一个 QQ 图功能ResidualsPlot,虽然该提交尚未完全部署但在此之前,您可以使用这些说明fork 和克隆 Yellowbrick ,然后按如下方式创建 QQ 图:

from sklearn.linear_model import Ridge
from sklearn.model_selection import train_test_split as tts

from yellowbrick.datasets import load_concrete
from yellowbrick.regressor import ResidualsPlot

# Load a regression dataset
X, y = load_concrete()

# Create the train and test data
X_train, X_test, y_train, y_test = tts(
    X, y, test_size=0.2, random_state=37
)

# Instantiate the visualizer,
# setting the `hist` param to False and the `qqplot` parameter to True
visualizer = ResidualsPlot(
    Ridge(), 
    hist=False, 
    qqplot=True,
    train_color="gold",
    test_color="maroon"
)
visualizer.fit(X_train, y_train)
visualizer.score(X_test, y_test)
visualizer.show()

结果如下: Yellowbrick 的 QQ 图示例

于 2020-06-09T18:50:38.267 回答