首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Yellowbrick预测误差图表编辑标签和图例

Yellowbrick预测误差图表编辑标签和图例
EN

Stack Overflow用户
提问于 2020-06-04 00:54:40
回答 1查看 174关注 0票数 0

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

代码语言:javascript
复制
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()   

这是我得到的输出:

EN

回答 1

Stack Overflow用户

发布于 2020-06-10 02:50:38

我们最近有一个贡献者在我们的ResidualsPlot中添加了QQ图功能,虽然提交还没有完全部署,但在那之前,你可以使用these instructions派生和克隆黄砖,然后创建QQ图,如下所示:

代码语言:javascript
复制
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()

结果如下:

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/62178352

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档