Skip to main content

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:

  1. Clone or download this repository and launch python within the folder.

  2. 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

  3. Install requirement.txt file into your new python environment

pip install -r requirements.txt
  1. 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:

demofig

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

eqfit-0.0.3.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

eqfit-0.0.3-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

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

Hashes for eqfit-0.0.3.tar.gz
Algorithm Hash digest
SHA256 a163c8b053126b9fb0b5cdbcaf2e821b55a2b62677bfc5b45e8feee227b65cbc
MD5 547169131b89309314382d5ed297db0b
BLAKE2b-256 271bb73b259a051b7912a4ebd90f7b0a4d8c64da218290085f6872385ff0d027

See more details on using hashes here.

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

Hashes for eqfit-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 b8915cf725c736ad8f8f420e83d4207d7c419d0b3f95510b2e80e5b6cb31c622
MD5 9176fe03437fe4d883a6b687f02c91d3
BLAKE2b-256 930606cf78d9d1bc9e3722f5967aa8ba01e572ef702edc6c6f2155ba33e2d8cf

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