In [2]:
%matplotlib inline

In [14]:
from sklearn.linear_model import Ridge
from sklearn.datasets import make_regression
from sklearn.model_selection import train_test_split as tts

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

# create a synthetic dataset
X, y = make_regression(
    n_samples=20000, 
    n_features=15, 
    noise=40.0,
    bias=100.0
)

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

# Instantiate the linear model and visualizer
model = Ridge(random_state=19)
visualizer = ResidualsPlot(
    model, 
    train_color="tomato", 
    test_color="navy",
    train_alpha=1.0,
    test_alpha=1.0,
    size=(1080, 720)
)

visualizer.fit(X_train, y_train)
visualizer.score(X_test, y_test)
visualizer.poof()



In [15]:
visualizer = ResidualsPlot(
    model, 
    train_color="tomato", 
    test_color="navy",
    train_alpha=0.35,
    test_alpha=0.35,
    size=(1080, 720)
)

visualizer.fit(X_train, y_train)
visualizer.score(X_test, y_test)
visualizer.poof()



In [ ]: