import sklearn.datasets
from sklearn.linear_model import LinearRegression
from model_inspector import get_inspector
Regressor
Inspector functionality specific to regression models
= sklearn.datasets.load_diabetes(return_X_y=True, as_frame=True)
X, y = get_inspector(LinearRegression().fit(X, y), X, y) inspector
_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 MatplotlibAxes
objects. Plot will be added to these objects if provided; otherwise a new array ofAxes
objects will be generated.scatter_kwargs
: kwargs to pass toplt.scatter
line_kwargs
: kwargs to pass toplt.plot
for line at y=0hist_kwargs
: kwargs to pass toplt.hist
for histogram of residuals
= inspector.plot_residuals() axes
_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
: MatplotlibAxes
object. Plot will be added to this object if provided; otherwise a newAxes
object will be generated.scatter_kwargs
: kwargs to pass toplt.scatter
line_kwargs
: kwargs to pass toplt.plot
= inspector.plot_pred_vs_act() ax