Skip to main content

FITTER documentation

https://badge.fury.io/py/fitter.svg https://github.com/cokelaer/fitter/actions/workflows/main.yml/badge.svg?branch=main https://coveralls.io/repos/github/cokelaer/fitter/badge.svg?branch=main Documentation Status https://zenodo.org/badge/23078551.svg https://img.shields.io/pypi/pyversions/fitter.svg https://img.shields.io/conda/vn/bioconda/fitter.svg https://img.shields.io/pypi/l/fitter.svg

Compatible with Python 3.9, 3.10, 3.11, 3.12, 3.13

What is it ?

The fitter package is a Python library used for fitting probability distributions to data. It provides a straightforward and and intuitive interface to estimate parameters for various types of distributions, both continuous and discrete. Using fitter, you can easily fit a range of distributions to your data and compare their fit, aiding in the selection of the most suitable distribution. The package is designed to be user-friendly and requires minimal setup, making it a useful tool for data scientists and statisticians working with probability distributions.

Installation

pip install fitter

fitter is also available on conda (bioconda channel):

conda install fitter

Usage

standalone

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 log fitter.log

From Python shell

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()
http://pythonhosted.org/fitter/_images/index-1.png

See the online documentation for details.

Contributors

Setting up and maintaining Fitter has been possible thanks to users and contributors. Thanks to all:

https://contrib.rocks/image?repo=cokelaer/fitter

Changelog

Version

Description

1.8.1

  • fix ks_pvalue ranking: highest p-value is now the best fit

  • raise ValueError when a distribution name is unknown

  • back to standard logging (fitter.fitter logger), loguru removed

1.8.0

  • add verbose option to Fitter to silence log output

  • skip distributions whose CDF is outside [0, 1]

  • update rich-click usage and set minimum Python version to 3.10

1.7.1

  • integrate PR github.com/cokelaer/fitter/pull/100 from @vitorandreazza to speedup multiprocessing run.

1.7.0

  • replace logging with loguru

  • main application update to add missing –output-image option and use rich_click

  • replace pkg_resources with importlib

1.6.0

1.5.2

1.5.1

  • fixed regression putting back joblib

1.5.0

  • removed easydev and replaced by tqdm for progress bar

  • progressbar from tqdm also allows replacement of joblib need

1.4.1

1.4.0

1.3.0

1.2.3

  • remove vervose arguments in Fitter class. Using the logging module instead

  • the Fitter.fit has now a progress bar

  • add a standalone application called … fitter (see the doc)

1.2.2

was not released

1.2.1

adding new class called histfit (see documentation)

1.2

1.1

  • Fixed deprecated warning

  • fitter is now in readthedocs at fitter.readthedocs.io

1.0.9

1.0.6

  • summary() now returns the dataframe (instead of printing it)

1.0.5

https://github.com/cokelaer/fitter/issues

1.0.2

add manifest to fix missing source in the pypi repository.

Metadata

Release files for fitter 1.8.1

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

Source distribution (sdist)

Source distribution for fitter 1.8.1
File Size Uploaded
fitter-1.8.1.tar.gz 31.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for fitter 1.8.1
File Interpreter ABI Platform
fitter-1.8.1-py3-none-any.whl Python 3 none any Details

Total release size: 62.1 kB

Release files / fitter-1.8.1.tar.gz

Download URL fitter-1.8.1.tar.gz
Size 31.1 kB
Tags Source
SHA-256 checksum
How to use checksums
dde80cc2a02b863935e3da80c193c151ac7d9e20751edadd251c233a3e0bd35d
BLAKE2b-256 checksum
How to use checksums
2e81564139623fcec2fc962ca8d319de88536ec8060b9f6f3a92d7e5631b366c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.3.4 CPython/3.11.15 Linux/6.14.5-100.fc40.x86_64

Release files / fitter-1.8.1-py3-none-any.whl

Download URL fitter-1.8.1-py3-none-any.whl
Size 31.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5c4e311d36a60a0fcafced666f3eb2923e5590912e19c8b9c697e0b86812fec2
BLAKE2b-256 checksum
How to use checksums
569b106262e61d40308b4ad7900a779eafe865263a6089a265b357f61324190b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.3.4 CPython/3.11.15 Linux/6.14.5-100.fc40.x86_64

Release history Release notifications | RSS feed

This release

1.8.1 This release

2 release files

1.8.0

2 release files

1.7.1

2 release files

1.7.0

2 release files

1.6.0

1 release file

1.5.2

1 release file

1.5.1

1 release file

1.5.0

1 release file

1.4.1

1 release file

1.4.0

1 release file

1.3.0

1 release file

1.2.3

1 release file

1.2.1

1 release file

1.2.0

1 release file

1.1.11

1 release file

1.1.10

1 release file

1.0.9

1 release file

1.0.8

1 release file

1.0.7

1 release file

1.0.6

1 release file

1.0.5

1 release file

1.0.4

1 release file

1.0.3

1 release file

1.0.2

1 release file

1.0.1

1 release file

1.0.0

1 release file

0.2.0

1 release file

0.1.0

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