Python package that analyses the given datasets and comes up with the best polynomial regression representation with the smallest polynomial degree possible, to be the most reliable with the least complexity possible
Project description
# Polynomial Regression
Python package that analyses the given datasets and comes up with the best polynomial regression representation with the smallest polynomial degree possible, to be the most reliable with the least complexity possible
Setup
Requirements:
-
Python installed
The ideal version, to run the package is 3.9.x, the version in which the package was built over,
however, older versions of python 3 shouldn't have any issues, as the package does not use any
fancy, new methods, not supported by older versions of Python 3.x -
Installing the package
For Microsoft Windows
pip install polinomial_regression_model
For Linux
pip3 install polinomial_regression_model
- Importing the package and getting the Class instance
Firstly, there are two ways to import and use the package properly, though the difference is negligible:
It is important to notice that either way its necessary to pass two same sized lists,
The first way is to import the Class Regression used for all the background processing itself,
and instantiate it like in the example below:
from polinomial_regression import Regression
regression = Regression([1, 2, 3, 4, 5], [2, 4, 6, 8, 10])
Or else, alternatively, its possible to use a function which returns the instance of the Class
like in the example below:
from polinomial_regression import regress
regression = regress([1, 2, 3, 4, 5], [2, 4, 6, 8, 10])
Again, which one to choose is totally up to you, and it doesn't change any results what so ever,
it's down to personal preference
Methods
- get_degree
regression.get_degree()
# returns the polynomial degree(index) of the best fitting function
# E.g. 4 in the case of the equation being a 4th degree polynomial
- get_ordinal
regression.get_ordinal()
# returns the polynomial degree ordinal suffix (for mere better display)
# E.g. th in the case of the equation being a 4"th" degree polynomial
- get_full_degree
regression.get_full_degree()
# returns the polynomial degree(index) of the best fitting function
# with its ordinal suffix
# E.g. 4th in the case of the equation being a "4th" degree polynomial
- get_coefficients
regression.get_coefficients()
# returns a list of all the coefficients of the polynomial equation
# E.g. [2, 3, 4, 5, 6] in case of the equation being
# y = 2x^4 + 3x³ + 4x² + 5x + 6
- get_r2
regression.get_r2()
# returns the coefficient of determination(R²) to find
# the accuracy of the best fitting regression just calculated
# E.g. 0.9 in the case of the equation being highly accurate]
# in relation to the test data
# I.e. although the perfect index would be 1, in real life data
# that is highly unlikely to happen
- get_prediction
regression.get_prediction(x: float)
# returns the prediction of the y value correspondent to
# the x value informed according to the regression calculated
# E.g. 794 in the case of the equation being y = 2x^4 + 3x³ + 4x² + 5x + 6
# (like the example above)
- equation_string
regression.equation_string()
# returns the polynomial equation calculated as a string
# to be better displayed if necessary
# E.g. y = 2x^4 + 3x³ + 4x² + 5x + 6 in the case of the example above
- visualization
regression.visualization()
# returns the a graphic plot of both a scatter plot of the
# real data and a line representing the regression calculated
- best_degree_polynomial
regression.best_degree_polynomial()
# returns the degree of the best fitting polynomial
# inside a string to be displayed
- coefficient_of_determination
regression.coefficient_of_determination()
# returns the coefficient of determination(R²) of the best
# fitting polynomial inside a string to be displayed
- equation_text
regression.equation_text()
# returns the best fitting polynomial inside a string
# to be displayed
- get_prediction
regression.get_prediction()
# returns the prediction of the y value correspondent to
# the x value informed according to the regression calculated
# E.g. 794 in the case of the equation being y = 2x^4 + 3x³ + 4x² + 5x + 6
# (like the example above)
- full_text_analysis
regression.full_text_analysis()
# returns the combination of the previous analysis, building
# the full analysis as a text
- full_analysis
regression.full_analysis()
# returns the full text analysis after plotting the
# visualization plots
- print_full_analysis
regression.print_full_analysis()
# prints the full text analysis and plots the
# visualization charts
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file polynomial_regression_model-2.0.0.tar.gz
.
File metadata
- Download URL: polynomial_regression_model-2.0.0.tar.gz
- Upload date:
- Size: 5.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | afac7cbaa96bb3db61cd4de8e4634be3fae62f743e3abda5d09cd5643ab13f2d |
|
MD5 | 29379de7c9d161b87deaf8d84330d544 |
|
BLAKE2b-256 | 1bf76edb561e7807358d24d9884bff2159414a6b2cfee021f4efb6eeeb876707 |
File details
Details for the file polynomial_regression_model-2.0.0-py3-none-any.whl
.
File metadata
- Download URL: polynomial_regression_model-2.0.0-py3-none-any.whl
- Upload date:
- Size: 7.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ecdf9e5c194776d83e7ef32d16b0d33a0290abb74f702c2e7f55ca8377f34c12 |
|
MD5 | 03cc62c5f41858140c7a52f12c6f7c72 |
|
BLAKE2b-256 | 4ffd5f406deb0155ffc0c55bbd62db1a104d5f903a760dd4a5c8e7b5dde513bd |