Skip to main content

Bias correction of regression ML models

Project description

Regression bias corrector

Package is aimed to correct regression fit by any machine learning model that underestimate high values and overestimate low values of outcome variable (1D case). The problem usually arises in case when metrics like MSE and MAE shows better results in biased predictions.

Algorithm

Now is implemeneted only linear correction for 1D case by the Linear Regression approach.

The idea is to linearly transform the y_pred to change the coefficient of linear regression between y_true and y_pred to 1. It is corresponds to the diagonal on plane y_true and y_pred that means equal pace of increasing y_pred with increasing y_true.

  • y_true - actual values
  • y_pred - predicted values

How to install

git clone https://github.com/mike-live/regression-bias-corrector.git
pip install .

How to use

# Import Linear Bias corrector
from regression-bias-corrector import LinearBiasCorrector

# Create instance of corrector
corrector = LinearBiasCorrector()

# Fit corrector on actual outcome variable and on predicted values of the model for train dataset
# y_train - actual values
# y_train_pred - predicted values
corrector.fit(y_train, y_train_pred)

# correct predicted values on test dataset
# y_test_pred - predicted values by model on test dataset
y_test_pred_unbiased = corrector.predict(y_test_pred)

# y_test_pred_unbiased - unbiased predicted values on test

Authors

Lobachevsky University

  1. Krivonosov Mikhail
  2. Khabarova Tatiana

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

regression_bias_corrector-0.0.2.tar.gz (88.0 kB view hashes)

Uploaded Source

Built Distribution

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page