Skip to main content

This is a simple script which tries to find the global minima using scipy.optimize.curve_fit as well as a parameter search over the parameter space. It first generates ntol random models, then selects ntol*returnnfactor best models and does scipy.optimize.curve_fit on all of them. It then returns the best model of them all. This script improves scipy.optimize.curve_fit in two ways - No need to give initial values and thus getting global minima instead of local minima. And second, it automatically normalize and standardizes the data.

FUTURE:

  1. Parallelize
  2. Use Genetic algorithm instead of brute-force

USAGE EXAMPLE: import brute_curvefit as bf import numpy as np import matplotlib.pyplot as plt def yourfunc(x, A,B,C): return (x-A)/B +C

params, error = bf.brute_then_scipy(func=yourfunc, x=np.arange(100), y=np.arange(100)**2, restrict=[[-1000,-1000,-1000],[1000,1000,1000]]) plt.plot(np.arange(100), np.arange(100)**2) #plotting data plt.plot(np.arange(100), yourfunc(np.arange(100), *params)) #plotting the fitted function plt.show() #As simple as that

Release files for brute-curvefit 0.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for brute-curvefit 0.0.4
File Size Uploaded
brute_curvefit-0.0.4.tar.gz 3.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for brute-curvefit 0.0.4
File Interpreter ABI Platform
brute_curvefit-0.0.4-py3-none-any.whl Python 3 none any Details

Total release size: 8.2 kB

Release files / brute_curvefit-0.0.4.tar.gz

Download URL brute_curvefit-0.0.4.tar.gz
Size 3.4 kB
Tags Source
SHA-256 checksum
How to use checksums
94124af5acfcc56efbc2d8a262327027218201148636222d63682ae983083f93
BLAKE2b-256 checksum
How to use checksums
85f2802424624b4f775cf2208596f536653ced71742121d5ebd505f89142c02d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.9

Release files / brute_curvefit-0.0.4-py3-none-any.whl

Download URL brute_curvefit-0.0.4-py3-none-any.whl
Size 4.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
42655a40a999d59a8375dc8be95eaea128323e2e70842ec9a22c56d757d5ff3a
BLAKE2b-256 checksum
How to use checksums
620530c424c1ecd16203b35e7201d848a03a30012857fe2808aa23005080526c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.9

Release history Release notifications | RSS feed

This release

0.0.4 This release

2 release files

0.0.3

2 release files

0.0.2

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page