Closed gsganden closed 2 years ago
This code plots the model as if it were a classification model rather than a regression model:
import sklearn.datasets from model_inspector import get_inspector from sklearn.linear_model import LinearRegression from sklearn.model_selection import GridSearchCV X_diabetes, y_diabetes = sklearn.datasets.load_diabetes(return_X_y=True, as_frame=True) X_diabetes = X_diabetes.iloc[:, [0]] grid = GridSearchCV(LinearRegression(), {}).fit(X_diabetes, y_diabetes) inspector = get_inspector(grid, X_diabetes, y_diabetes) ax = inspector.plot()
It would ideally recognize that grid.best_estimator_ is a regression model and plot it accordingly:
grid.best_estimator_
inspector = get_inspector(grid.best_estimator_, X_diabetes, y_diabetes) ax = inspector.plot()
Alternatively, it could refuse to plot, requiring the user to make the inspector from grid.best_estimator_.
This code plots the model as if it were a classification model rather than a regression model:
It would ideally recognize that
grid.best_estimator_
is a regression model and plot it accordingly:Alternatively, it could refuse to plot, requiring the user to make the inspector from
grid.best_estimator_
.