【问题标题】:Yellowbrick prediction error graph edit lables and legendsYellowbrick 预测错误图编辑标签和图例
【发布时间】:2020-09-22 11:26:43
【问题描述】:

我想使用 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()   

这是我得到的输出:

【问题讨论】:

    标签: python machine-learning visualization yellowbrick


    【解决方案1】:

    我们最近有一个贡献者向我们的ResidualsPlot 添加了一个 QQ 绘图功能,虽然该提交尚未部署相当,但在那之前,您可以使用 these instructions 分叉和克隆 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()
    

    结果如下:

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-05-28
      • 2017-12-25
      • 2014-07-01
      • 2015-08-14
      相关资源
      最近更新 更多