import sklearn.datasets
from sklearn.linear_model import LinearRegression
from model_inspector import get_inspectorRegressor
Inspector functionality specific to regression models
X, y = sklearn.datasets.load_diabetes(return_X_y=True, as_frame=True)
inspector = get_inspector(LinearRegression().fit(X, y), X, y)_RegInspector.plot_residuals
_RegInspector.plot_residuals (axes:Optional[<built- infunctionarray>]=None, scatter_kwargs:Optional[dict]=None, line_kwargs:Optional[dict]=None, hist_kwargs:Optional[dict]=None)
Plot residuals.
Parameters:
axes: 1D array of two MatplotlibAxesobjects. Plot will be added to these objects if provided; otherwise a new array ofAxesobjects will be generated.scatter_kwargs: kwargs to pass toplt.scatterline_kwargs: kwargs to pass toplt.plotfor line at y=0hist_kwargs: kwargs to pass toplt.histfor histogram of residuals
axes = inspector.plot_residuals()
_RegInspector.plot_pred_vs_act
_RegInspector.plot_pred_vs_act (ax:Optional[matplotlib.axes._axes.Axes]= None, scatter_kwargs:Optional[dict]=None, line_kwargs:Optional[dict]=None)
Plot predicted vs. actual values.
Parameters:
ax: MatplotlibAxesobject. Plot will be added to this object if provided; otherwise a newAxesobject will be generated.scatter_kwargs: kwargs to pass toplt.scatterline_kwargs: kwargs to pass toplt.plot
ax = inspector.plot_pred_vs_act()