eqfit - Equation fitting automation made simple with python.
Note: this is an early evaluation of what such a package might look like. If you are interested in contributing and/or guiding the direction of this project please feel free to reach out.
Installation
eqfit can be installed using pip:
pip install eqfit
To get started quickly from source follow these steps:
-
Clone or download this repository and launch python within the folder.
-
Make a python environment to run in. Always recommend the use of virtual environments for safety. Must be Python3 and currently only tested with Python 3.8
-
Install requirement.txt file into your new python environment
pip install -r requirements.txt
- Test the module is working on the example dataset using the demo.py script in the example directory.
python demo.py
If everything worked you should get the following figure output:
Example
This example will cover the API to call eqfit on your data. It will utilise the example dataset provided. In this example, there are five input parameters (A-E) and one test parameter (Y). We want to figure out a suitable polynomial equation for predicting Y from the parameters A-E. The below is a heavily commented version of the demo python script to explain how we do this.
import eqfit # import eqfit
import pandas as pd # import pandas to load data
# example data loaded you can replace this with the data you wish to fit to.
# this does not have to be a .csv, but you will need to get it in a pandas dataframe.
data = pd.read_csv('example/exampledata.csv')
# create eqfit object
eq = eqfit.fitter()
# sets the input parameters for the equation you want make.
# you can check these at any point by calling eq.X
eq.set_inputs(data.drop(columns=['Y']))
# sets the prediction column (i.e. what you want the equation to calculate)
# you can check this at any point by calling eq.Y
eq.set_target(data['Y'])
# splits the data in testing and training
eq.train_test_split()
# runs the polyfit which iteratively goes through different polynomial degrees and attempts to fit the data.
eq.do_polyfit(verbose=True)
# makes an equation from the best performing polynomial degree tested
# removes polynomial terms where the effective coefficient is below 100
eq.make_equation(param_notation=['A', 'B', 'C', 'D', 'E'], coef_cutoff=100)
# uses the created equation to calculate the equation predicted target values and compares them to the ones set by eq.set_target.
eq.evaluate_equation()
This covers the various functions included. For further details on each function please refer to the docstring by calling the help function. For example:
help(eq.do_polyfit)
Dependencies
Release files for eqfit 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| eqfit-0.0.3.tar.gz | 5.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| eqfit-0.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 12.0 kB
Release files / eqfit-0.0.3.tar.gz
| Download URL | eqfit-0.0.3.tar.gz |
|---|---|
| Size | 5.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a163c8b053126b9fb0b5cdbcaf2e821b55a2b62677bfc5b45e8feee227b65cbc
|
|
BLAKE2b-256 checksum How to use checksums |
271bb73b259a051b7912a4ebd90f7b0a4d8c64da218290085f6872385ff0d027
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.2
|
Release files / eqfit-0.0.3-py3-none-any.whl
| Download URL | eqfit-0.0.3-py3-none-any.whl |
|---|---|
| Size | 6.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b8915cf725c736ad8f8f420e83d4207d7c419d0b3f95510b2e80e5b6cb31c622
|
|
BLAKE2b-256 checksum How to use checksums |
930606cf78d9d1bc9e3722f5967aa8ba01e572ef702edc6c6f2155ba33e2d8cf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.2
|