Equation fitting automation made simple with python
Project description
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
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 eqfit-0.0.3.tar.gz
.
File metadata
- Download URL: eqfit-0.0.3.tar.gz
- Upload date:
- Size: 5.6 kB
- Tags: Source
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a163c8b053126b9fb0b5cdbcaf2e821b55a2b62677bfc5b45e8feee227b65cbc |
|
MD5 | 547169131b89309314382d5ed297db0b |
|
BLAKE2b-256 | 271bb73b259a051b7912a4ebd90f7b0a4d8c64da218290085f6872385ff0d027 |
File details
Details for the file eqfit-0.0.3-py3-none-any.whl
.
File metadata
- Download URL: eqfit-0.0.3-py3-none-any.whl
- Upload date:
- Size: 6.4 kB
- Tags: Python 3
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b8915cf725c736ad8f8f420e83d4207d7c419d0b3f95510b2e80e5b6cb31c622 |
|
MD5 | 9176fe03437fe4d883a6b687f02c91d3 |
|
BLAKE2b-256 | 930606cf78d9d1bc9e3722f5967aa8ba01e572ef702edc6c6f2155ba33e2d8cf |