Skip to main content

A tool to fit data to many distributions and best one(s)

Project description

https://badge.fury.io/py/fitter.svg https://secure.travis-ci.org/cokelaer/fitter.png https://coveralls.io/repos/cokelaer/fitter/badge.png?branch=master Documentation Status

Compatible with Python 2.7 and 3.6 and 3.7 (Travis tests)

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)

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()

A standalone application (very simple) is also provided and works with input CSV files:

fitter fitdist data.csv --column-number 1 --distributions gamma,normal

It creates a file called fitter.png and a file called fitter.log.

http://pythonhosted.org/fitter/_images/index-1.png

See the online documentation for details.

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

fitter-1.2.3.tar.gz (24.7 kB view details)

Uploaded Source

File details

Details for the file fitter-1.2.3.tar.gz.

File metadata

  • Download URL: fitter-1.2.3.tar.gz
  • Upload date:
  • Size: 24.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.1.post20200529 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.3

File hashes

Hashes for fitter-1.2.3.tar.gz
Algorithm Hash digest
SHA256 f801a26f318f4bec8d1b8b4a0958004d2bbf29a0332e2c583560107cb5d78ff3
MD5 5eb127c83dd8ba35847e556d8c8316f8
BLAKE2b-256 a69a72883003414a2d4288130068d8c511246bb4a6ba23f9c71d3292b016dd7b

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