Scikeras Keras Regressor

18 views
Skip to first unread message

Seyed Faraz Eftekhar

unread,
Nov 28, 2022, 3:49:30 PM11/28/22
to Yellowbrick
Hi,

I have developed the model in Keras and used Scikeras KerasRegressor for wrapping keras model.
But I was not able to plot the Prediction Error plot.

Any help and recommendation is appreciated :)


Screenshot 2022-11-28 214854.png

Yellowbrick

unread,
Dec 1, 2022, 9:50:36 AM12/1/22
to Yellowbrick
Hello, 

The PredictionError plot requires data in order to plot the residuals against the predicted value; simply passing in the regressor is not sufficient to draw the plot. 

To pass data into the plot, you'll have to call `fit()` and `score()` on the model. However, you obviously don't want to fit the model again (since it probably takes a while to train a DLN). To prevent refitting you can use the `is_fitted` argument as follows:

visualizer = PredictionError(mlp, is_fitted=True) 
visualizer.fit(X_train, y_train)
visualizer.score(X_test, y_test) 
visualizer.show() 

Please note that Yellowbrick was developed for scikit-learn integration specifically. If the scikeras KerasRegressor works - that's great! However, we don't spend a lot of time testing external third-party models. If it doesn't work and you're interested in using Keras with Yellowbrick, we'd appreciate any pull requests into our contrib package to support it! 

Best Regards,
Benjamin Bengfort
Reply all
Reply to author
Forward
0 new messages