Skip to main content

Regression workflows package based on Least Squares Regression and Quantile Regression.

Project description

Regressionizer

Python package with a class that allows pipeline-like specification and execution of regression workflows.

Extensive guide is given in the Jupyter notebook "Rapid-specification-of-regression-workflows.ipynb" and the corresponding Markdown document "Rapid-specification-of-regression-workflows.md".


Features summary

  • The class Regressionizer facilitates rapid specifications of regressions workflows.

    • To quickly specify:
      • data rescaling and summary
      • regression computations
      • outliers finding
      • conditional Cumulative Distribution Functions (CDFs) reconstruction
      • plotting of data, fits, residual errors, outliers, CDFs
  • Regressionizer works with data frames, numpy arrays, lists of numbers, and lists of numeric pairs.

Details and arguments

  • The curves computed with Quantile Regression are called regression quantiles.

  • Regressionizer has three regression methods:

    • quantile_regression
    • quantile_regression_fit
    • least_squares_fit
  • The regression quantiles computed with the methods quantile_regression and quantile_regression_fit correspond to probabilities specified with the argument probs.

  • The methodquantile_regression computes fits using a B-spline functions basis.

    • The basis is specified with the arguments knots and order.
    • order is 3 by default.
  • The methods quantile_regession_fit and least_squares_fit use lists of basis functions to fit with specified with the argument funcs.

Workflows flowchart

The following flowchart summarizes the workflows that are supported by Regressionizer:


Usage examples

Import libraries:

from Regressionizer import *
import numpy as np

Generate random data:

np.random.seed(0)
x = np.linspace(0, 2, 300)
y = np.sin(2 * np.pi * x) + np.random.normal(0, 0.4, x.shape)
data = np.column_stack((x, y)

Compute quantile regression for probabilities [0.2, 0.5, 0.8] and make the corresponding plot:

obj = (Regressionizer(data)
       .quantile_regression(knots=8, probs=[0.2, 0.5, 0.8])
       .plot(title="B-splines fit", template="plotly")
       )

Show the plot obtained above:

obj.take_value().show()


References

Articles, books

[RK1] Roger Koenker, Quantile Regression, Cambridge University Press, 2005.

[RK2] Roger Koenker, "Quantile Regression in R: a vignette", (2006), CRAN.

[AA1] Anton Antonov, "A monad for Quantile Regression workflows", (2018), MathematicaForPrediction at GitHub.

Packages, paclets

[RKp1] Roger Koenker, quantreg, CRAN.

[AAp1] Anton Antonov, Quantile Regression WL paclet, (2014-2023), GitHub/antononcube.

[AAp2] Anton Antonov, Monadic Quantile Regression WL paclet, (2018-2024), GitHub/antononcube.

[AAp3] Anton Antonov, QuantileRegression, (2019), Wolfram Function Repository.

Repositories

[AAr1] Anton Antonov, DSL::English::QuantileRegressionWorkflows in Raku, (2020), GitHub/antononcube.

Videos

[AAv1] Anton Antonov, "Boston useR! QuantileRegression Workflows 2019-04-18", (2019), Anton Antonov at YouTube.

[AAv2] Anton Antonov, "useR! 2020: How to simplify Machine Learning workflows specifications", (2020), R Consortium at YouTube.

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

regressionizer-0.1.8.tar.gz (24.6 kB view details)

Uploaded Source

Built Distribution

Regressionizer-0.1.8-py3-none-any.whl (22.8 kB view details)

Uploaded Python 3

File details

Details for the file regressionizer-0.1.8.tar.gz.

File metadata

  • Download URL: regressionizer-0.1.8.tar.gz
  • Upload date:
  • Size: 24.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.2

File hashes

Hashes for regressionizer-0.1.8.tar.gz
Algorithm Hash digest
SHA256 64790eb6db6e7aeba18bd168837162ed1f9052e3fae20b0b50553f38c461a14c
MD5 773f35138c7b9ea00789ce81595fc43b
BLAKE2b-256 172dc27578d995011a2be132fcfa396e813cbd5ec771a636585db7b3a5d3ebbe

See more details on using hashes here.

File details

Details for the file Regressionizer-0.1.8-py3-none-any.whl.

File metadata

File hashes

Hashes for Regressionizer-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 b2b80fda22e788dd28a7f5f5da77d4655da871b71a1aac384c279003f835844a
MD5 dbde0ae1c19785e9bc58cc6f99b75085
BLAKE2b-256 9daab2230f90613563dd63cf72b2a53adc74ff852295ce5b7c81c9455d05677f

See more details on using hashes here.

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