rishita agnihotri
rishita agnihotri

Reputation: 63

Yellowbrick prediction error graph edit lables and legends

I want to plot prediction-error using Yellowbrick visualizer but i am not getting the desired results. The plot is similar to the pp plot or a qq plot which is not correct. Also i am not able to change the labels of the axes and add title nor am i getting any by default labels and legend. can anyone please tell me what should i do. here's the code for visualizer:

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()   

This is the output i am getting:

enter image description here

Upvotes: 0

Views: 512

Answers (1)

rebeccabilbro
rebeccabilbro

Reputation: 477

We recently had a contributor add a QQ plot feature to our ResidualsPlot, and while that commit is not deployed quite yet, until then, you can fork and clone Yellowbrick using these instructions, and then create QQ plots as follows:

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()

Here's the result: Example of QQ-plot with Yellowbrick

Upvotes: 1

Related Questions