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.1.tar.gz (86.9 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file regression_bias_corrector-0.0.1.tar.gz.

File metadata

File hashes

Hashes for regression_bias_corrector-0.0.1.tar.gz
Algorithm Hash digest
SHA256 9bf34d40ea774649f383e15755e0e1081c3bad54dc8289934d5ad6c13cb093c6
MD5 f81fcfe92d017d029881efac16b71b62
BLAKE2b-256 11aa50240a9d3fde5e77105dcbaab30f00591fe91564ff03b2bd45345547ab7c

See more details on using hashes here.

Provenance

File details

Details for the file regression_bias_corrector-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for regression_bias_corrector-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ebbe37743d9512208431d758625b1189c2ca4d7358b456b900a743a55a88b3a6
MD5 120321043f51fc316fe6c9884c8ed075
BLAKE2b-256 adebcdf071ef4fbb4da9bbc3c84a0384d576c1f16b6ef021f80511ffad8a20e5

See more details on using hashes here.

Provenance

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