Regressionizer


NameRegressionizer JSON
Version 0.1.8 PyPI version JSON
download
home_pagehttps://github.com/antononcube/Python-Regressionizer
SummaryRegression workflows package based on Least Squares Regression and Quantile Regression.
upload_time2024-08-31 00:52:01
maintainerNone
docs_urlNone
authorAnton Antonov
requires_python>=3.7
licenseNone
keywords regression quantile quantile regression linear linear regression workflow
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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"](https://github.com/antononcube/Python-Regressionizer/blob/main/docs/Rapid-specification-of-regression-workflows.ipynb) 
and the corresponding Markdown document
["Rapid-specification-of-regression-workflows.md"](https://github.com/antononcube/Python-Regressionizer/blob/main/docs/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 method`quantile_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`:

![](https://raw.githubusercontent.com/antononcube/Python-Regressionizer/main/docs/img/Quantile-regression-workflow-extended.jpg)


------

## Usage examples 

Import libraries:

```python
from Regressionizer import *
import numpy as np
```

Generate random data:

```python
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:

```python
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:

```python
obj.take_value().show()
```

![](https://raw.githubusercontent.com/antononcube/Python-Regressionizer/main/docs/img/random-data-B-spline-rqs.png)

------

## References

### Articles, books

[RK1] Roger Koenker, 
[Quantile Regression](https://books.google.com/books/about/Quantile_Regression.html?id=hdkt7V4NXsgC), 
Cambridge University Press, 2005.

[RK2] Roger Koenker,
["Quantile Regression in R: a vignette"](https://cran.r-project.org/web/packages/quantreg/vignettes/rq.pdf),
(2006),
[CRAN](https://cran.r-project.org/).

[AA1] Anton Antonov,
["A monad for Quantile Regression workflows"](https://github.com/antononcube/MathematicaForPrediction/blob/master/MarkdownDocuments/A-monad-for-Quantile-Regression-workflows.md),
(2018),
[MathematicaForPrediction at GitHub](https://github.com/antononcube/MathematicaForPrediction).

### Packages, paclets

[RKp1] Roger Koenker,
[`quantreg`](https://cran.r-project.org/web/packages/quantreg/index.html),
[CRAN](https://cran.r-project.org/).

[AAp1] Anton Antonov,
[Quantile Regression WL paclet](https://github.com/antononcube/WL-QuantileRegression-paclet),
(2014-2023),
[GitHub/antononcube](https://github.com/antononcube).

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

[AAp3] Anton Antonov,
[`QuantileRegression`](https://resources.wolframcloud.com/FunctionRepository/resources/QuantileRegression),
(2019),
[Wolfram Function Repository](https://resources.wolframcloud.com/FunctionRepository/resources/QuantileRegression).

### Repositories

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

### Videos

[AAv1] Anton Antonov,
["Boston useR! QuantileRegression Workflows 2019-04-18"](https://www.youtube.com/watch?v=a_Dk25xarvE),
(2019),
[Anton Antonov at YouTube](https://www.youtube.com/@AAA4Prediction).

[AAv2] Anton Antonov,
["useR! 2020: How to simplify Machine Learning workflows specifications"](https://www.youtube.com/watch?v=b9Uu7gRF5KY),
(2020),
[R Consortium at YouTube](https://www.youtube.com/channel/UC_R5smHVXRYGhZYDJsnXTwg).

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/antononcube/Python-Regressionizer",
    "name": "Regressionizer",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "regression, quantile, quantile regression, linear, linear regression, workflow",
    "author": "Anton Antonov",
    "author_email": "antononcube@posteo.net",
    "download_url": "https://files.pythonhosted.org/packages/17/2d/c27578d995011a2be132fcfa396e813cbd5ec771a636585db7b3a5d3ebbe/regressionizer-0.1.8.tar.gz",
    "platform": null,
    "description": "# Regressionizer\n\nPython package with a class that allows pipeline-like specification and execution of regression workflows.\n\nExtensive guide is given in the Jupyter notebook \n[\"Rapid-specification-of-regression-workflows.ipynb\"](https://github.com/antononcube/Python-Regressionizer/blob/main/docs/Rapid-specification-of-regression-workflows.ipynb) \nand the corresponding Markdown document\n[\"Rapid-specification-of-regression-workflows.md\"](https://github.com/antononcube/Python-Regressionizer/blob/main/docs/Rapid-specification-of-regression-workflows.md).\n\n------\n\n## Features summary \n\n- The class `Regressionizer` facilitates rapid specifications of regressions workflows.\n  - To quickly specify: \n    - data rescaling and summary\n    - regression computations\n    - outliers finding\n    - conditional Cumulative Distribution Functions (CDFs) reconstruction\n    - plotting of data, fits, residual errors, outliers, CDFs \n\n- `Regressionizer` works with data frames, numpy arrays, lists of numbers, and lists of numeric pairs.\n\n\n### Details and arguments\n\n- The curves computed with Quantile Regression are called **regression quantiles**.\n\n- `Regressionizer` has three regression methods:\n  - `quantile_regression`\n  - `quantile_regression_fit`\n  - `least_squares_fit`\n  \n- The regression quantiles computed with the methods `quantile_regression` and `quantile_regression_fit` \n  correspond to probabilities specified with the argument `probs`.\n\n- The method`quantile_regression` computes fits using a B-spline functions basis.  \n  - The basis is specified with the arguments `knots` and `order`.\n  - `order` is 3 by default. \n\n- The methods `quantile_regession_fit` and `least_squares_fit` use lists of basis functions to fit with \n  specified with the argument `funcs`.\n\n### Workflows flowchart\n\nThe following flowchart summarizes the workflows that are supported by `Regressionizer`:\n\n![](https://raw.githubusercontent.com/antononcube/Python-Regressionizer/main/docs/img/Quantile-regression-workflow-extended.jpg)\n\n\n------\n\n## Usage examples \n\nImport libraries:\n\n```python\nfrom Regressionizer import *\nimport numpy as np\n```\n\nGenerate random data:\n\n```python\nnp.random.seed(0)\nx = np.linspace(0, 2, 300)\ny = np.sin(2 * np.pi * x) + np.random.normal(0, 0.4, x.shape)\ndata = np.column_stack((x, y)\n```\n\nCompute quantile regression for probabilities `[0.2, 0.5, 0.8]` and make the corresponding plot:\n\n```python\nobj = (Regressionizer(data)\n       .quantile_regression(knots=8, probs=[0.2, 0.5, 0.8])\n       .plot(title=\"B-splines fit\", template=\"plotly\")\n       )\n```\n\nShow the plot obtained above:\n\n```python\nobj.take_value().show()\n```\n\n![](https://raw.githubusercontent.com/antononcube/Python-Regressionizer/main/docs/img/random-data-B-spline-rqs.png)\n\n------\n\n## References\n\n### Articles, books\n\n[RK1] Roger Koenker, \n[Quantile Regression](https://books.google.com/books/about/Quantile_Regression.html?id=hdkt7V4NXsgC), \nCambridge University Press, 2005.\n\n[RK2] Roger Koenker,\n[\"Quantile Regression in R: a vignette\"](https://cran.r-project.org/web/packages/quantreg/vignettes/rq.pdf),\n(2006),\n[CRAN](https://cran.r-project.org/).\n\n[AA1] Anton Antonov,\n[\"A monad for Quantile Regression workflows\"](https://github.com/antononcube/MathematicaForPrediction/blob/master/MarkdownDocuments/A-monad-for-Quantile-Regression-workflows.md),\n(2018),\n[MathematicaForPrediction at GitHub](https://github.com/antononcube/MathematicaForPrediction).\n\n### Packages, paclets\n\n[RKp1] Roger Koenker,\n[`quantreg`](https://cran.r-project.org/web/packages/quantreg/index.html),\n[CRAN](https://cran.r-project.org/).\n\n[AAp1] Anton Antonov,\n[Quantile Regression WL paclet](https://github.com/antononcube/WL-QuantileRegression-paclet),\n(2014-2023),\n[GitHub/antononcube](https://github.com/antononcube).\n\n[AAp2] Anton Antonov,\n[Monadic Quantile Regression WL paclet](https://github.com/antononcube/WL-MonadicQuantileRegression-paclet),\n(2018-2024),\n[GitHub/antononcube](https://github.com/antononcube).\n\n[AAp3] Anton Antonov,\n[`QuantileRegression`](https://resources.wolframcloud.com/FunctionRepository/resources/QuantileRegression),\n(2019),\n[Wolfram Function Repository](https://resources.wolframcloud.com/FunctionRepository/resources/QuantileRegression).\n\n### Repositories\n\n[AAr1] Anton Antonov,\n[DSL::English::QuantileRegressionWorkflows in Raku](https://github.com/antononcube/Raku-DSL-English-QuantileRegressionWorkflows),\n(2020),\n[GitHub/antononcube](https://github.com/antononcube/Raku-DSL-English-QuantileRegressionWorkflows).\n\n### Videos\n\n[AAv1] Anton Antonov,\n[\"Boston useR! QuantileRegression Workflows 2019-04-18\"](https://www.youtube.com/watch?v=a_Dk25xarvE),\n(2019),\n[Anton Antonov at YouTube](https://www.youtube.com/@AAA4Prediction).\n\n[AAv2] Anton Antonov,\n[\"useR! 2020: How to simplify Machine Learning workflows specifications\"](https://www.youtube.com/watch?v=b9Uu7gRF5KY),\n(2020),\n[R Consortium at YouTube](https://www.youtube.com/channel/UC_R5smHVXRYGhZYDJsnXTwg).\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Regression workflows package based on Least Squares Regression and Quantile Regression.",
    "version": "0.1.8",
    "project_urls": {
        "Homepage": "https://github.com/antononcube/Python-Regressionizer"
    },
    "split_keywords": [
        "regression",
        " quantile",
        " quantile regression",
        " linear",
        " linear regression",
        " workflow"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9daab2230f90613563dd63cf72b2a53adc74ff852295ce5b7c81c9455d05677f",
                "md5": "dbde0ae1c19785e9bc58cc6f99b75085",
                "sha256": "b2b80fda22e788dd28a7f5f5da77d4655da871b71a1aac384c279003f835844a"
            },
            "downloads": -1,
            "filename": "Regressionizer-0.1.8-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "dbde0ae1c19785e9bc58cc6f99b75085",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 22794,
            "upload_time": "2024-08-31T00:51:59",
            "upload_time_iso_8601": "2024-08-31T00:51:59.865940Z",
            "url": "https://files.pythonhosted.org/packages/9d/aa/b2230f90613563dd63cf72b2a53adc74ff852295ce5b7c81c9455d05677f/Regressionizer-0.1.8-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "172dc27578d995011a2be132fcfa396e813cbd5ec771a636585db7b3a5d3ebbe",
                "md5": "773f35138c7b9ea00789ce81595fc43b",
                "sha256": "64790eb6db6e7aeba18bd168837162ed1f9052e3fae20b0b50553f38c461a14c"
            },
            "downloads": -1,
            "filename": "regressionizer-0.1.8.tar.gz",
            "has_sig": false,
            "md5_digest": "773f35138c7b9ea00789ce81595fc43b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 24568,
            "upload_time": "2024-08-31T00:52:01",
            "upload_time_iso_8601": "2024-08-31T00:52:01.362453Z",
            "url": "https://files.pythonhosted.org/packages/17/2d/c27578d995011a2be132fcfa396e813cbd5ec771a636585db7b3a5d3ebbe/regressionizer-0.1.8.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-31 00:52:01",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "antononcube",
    "github_project": "Python-Regressionizer",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "regressionizer"
}
        
Elapsed time: 0.33691s