fit data to many distributions
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
doc Increase timeout to 30 seconds; This is due to a modification in scip… Nov 28, 2016
src/fitter
test
.travis.yml update version scipy Nov 28, 2016
HISTORY.rst fix travis. Add doc. Dec 3, 2015
MANIFEST.in
README.rst Increase timeout to 30 seconds; This is due to a modification in scip… Nov 28, 2016
setup.cfg Add requested from issue #1 Apr 14, 2016
setup.py Increase timeout to 30 seconds; This is due to a modification in scip… Nov 28, 2016

README.rst

FITTER documentation

https://secure.travis-ci.org/cokelaer/fitter.png https://coveralls.io/repos/cokelaer/fitter/badge.png?branch=master https://landscape.io/github/cokelaer/fitter/master/landscape.png https://badge.waffle.io/cokelaer/fitter.png?label=ready&title=Ready

Compatible with Python 2.7 and 3.3, 3.4, 3.5

What is it ?

fitter package provides a simple class to identify the distribution from which a data samples is generated from. It uses 80 distributions from Scipy and allows you to plot the results to check what is the most probable distribution and the best parameters.

Installation

pip install fitter

Usage

First, let us create a data samples with N = 10,000 points from a gamma distribution:

from scipy import stats
data = stats.gamma.rvs(2, loc=1.5, scale=2, size=10000)

Note

the fitting is slow so keep the size value to reasonable value.

Now, without any knowledge about the distribution or its parameter, what is the distribution that fits the data best ? Scipy has 80 distributions and the Fitter class will scan all of them, call the fit function for you, ignoring those that fail or run forever and finally give you a summary of the best distributions in the sense of sum of the square errors. The best is to give an example:

from fitter import Fitter
f = Fitter(data)
f.fit()
# may take some time since by default, all distributions are tried
# but you call manually provide a smaller set of distributions
f.summary()
http://pythonhosted.org/fitter/_images/index-1.png

See the online documentation for details.