Regression Systematic Error#

Imports#

from sklearn.datasets import load_diabetes
from sklearn.ensemble import GradientBoostingRegressor
from sklearn.model_selection import train_test_split

from deepchecks.tabular import Dataset
from deepchecks.tabular.checks.performance import RegressionSystematicError

Generating data#

diabetes_df = load_diabetes(return_X_y=False, as_frame=True).frame
train_df, test_df = train_test_split(diabetes_df, test_size=0.33, random_state=42)
train_df['target'] = train_df['target'] + 150

train = Dataset(train_df, label='target', cat_features=['sex'])
test = Dataset(test_df, label='target', cat_features=['sex'])

clf = GradientBoostingRegressor(random_state=0)
_ = clf.fit(train.data[train.features], train.data[train.label_name])

Running RegressionSystematicError check#

check = RegressionSystematicError()
check.run(test, clf)

Regression Systematic Error

Check the regression systematic error.

Additional Outputs
Non-zero mean of the error distribution indicated the presents of systematic error in model predictions


Total running time of the script: ( 0 minutes 0.086 seconds)

Gallery generated by Sphinx-Gallery