fitter


Namefitter JSON
Version 1.7.1 PyPI version JSON
download
home_pageNone
SummaryA tool to fit data to many distributions and get the best one(s)
upload_time2024-06-24 08:50:58
maintainerNone
docs_urlhttps://pythonhosted.org/fitter/
authorThomas Cokelaer
requires_python<4.0,>=3.8
licenseGPL
keywords fit distribution fitting scipy
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            

#############################
FITTER documentation
#############################

.. image:: https://badge.fury.io/py/fitter.svg
    :target: https://pypi.python.org/pypi/fitter

.. image:: https://github.com/cokelaer/fitter/actions/workflows/main.yml/badge.svg?branch=main
    :target: https://github.com/cokelaer/fitter/actions/workflows/main.yml

.. image:: https://coveralls.io/repos/cokelaer/fitter/badge.png?branch=main
    :target: https://coveralls.io/r/cokelaer/fitter?branch=main

.. image:: http://readthedocs.org/projects/fitter/badge/?version=latest
    :target: http://fitter.readthedocs.org/en/latest/?badge=latest
    :alt: Documentation Status

.. image:: https://zenodo.org/badge/23078551.svg
   :target: https://zenodo.org/badge/latestdoi/23078551

Compatible with Python 3.7, and 3.8, 3.9


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)

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


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


See the `online <http://fitter.readthedocs.io/>`_ documentation for details.


Contributors
=============


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

.. image:: https://contrib.rocks/image?repo=cokelaer/fitter
    :target: https://github.com/cokelaer/fitter/graphs/contributors




Changelog
~~~~~~~~~
========= ==========================================================================
Version   Description
========= ==========================================================================
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     * for developers: uses pyproject.toml instead of setup.py
          * Fix progress bar fixing https://github.com/cokelaer/fitter/pull/74
          * Fix BIC formula https://github.com/cokelaer/fitter/pull/77
1.5.2     * PR https://github.com/cokelaer/fitter/pull/74 to fix logger
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     * Update timeout in docs from 10 to 30 seconds by @mpadge in
            https://github.com/cokelaer/fitter/pull/47
          * Add Kolmogorov-Smirnov goodness-of-fit statistic by @lahdjirayhan in
            https://github.com/cokelaer/fitter/pull/58
          * switch branch from master to main
1.4.0     * get_best function now returns the parameters as a dictionary
            of parameter names and their values rather than just a list of
            values (https://github.com/cokelaer/fitter/issues/23) thanks to
            contributor @kabirmdasraful
          * Accepting PR to fix progress bar issue reported in
            https://github.com/cokelaer/fitter/pull/37
1.3.0     * parallel process implemented https://github.com/cokelaer/fitter/pull/25
            thanks to @arsenyinfo
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       * Fixed the version. Previous version switched from
            1.0.9 to 1.1.11. To start a fresh version, we increase to 1.2.0
          * Merged pull request required by bioconda
          * Merged pull request related to implementation of
            AIC/BIC/KL criteria (https://github.com/cokelaer/fitter/pull/19).
            This also fixes https://github.com/cokelaer/fitter/issues/9
          * Implement two functions to get all distributions, or a list of
            common distributions to help users decreading computational time
            (https://github.com/cokelaer/fitter/issues/20). Also added a FAQS
            section.
          * travis tested Python 3.6 and 3.7 (not 3.5 anymore)
1.1       * Fixed deprecated warning
          * fitter is now in readthedocs at fitter.readthedocs.io
1.0.9     * https://github.com/cokelaer/fitter/pull/8 and 11
            PR https://github.com/cokelaer/fitter/pull/8
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.
========= ==========================================================================

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "fitter",
    "maintainer": null,
    "docs_url": "https://pythonhosted.org/fitter/",
    "requires_python": "<4.0,>=3.8",
    "maintainer_email": null,
    "keywords": "fit, distribution, fitting, scipy",
    "author": "Thomas Cokelaer",
    "author_email": "cokelaer@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/fa/e2/43c5db5bd54ab13b6535859f01e340e19e775fe0b78c299966948cfca089/fitter-1.7.1.tar.gz",
    "platform": null,
    "description": "\n\n#############################\nFITTER documentation\n#############################\n\n.. image:: https://badge.fury.io/py/fitter.svg\n    :target: https://pypi.python.org/pypi/fitter\n\n.. image:: https://github.com/cokelaer/fitter/actions/workflows/main.yml/badge.svg?branch=main\n    :target: https://github.com/cokelaer/fitter/actions/workflows/main.yml\n\n.. image:: https://coveralls.io/repos/cokelaer/fitter/badge.png?branch=main\n    :target: https://coveralls.io/r/cokelaer/fitter?branch=main\n\n.. image:: http://readthedocs.org/projects/fitter/badge/?version=latest\n    :target: http://fitter.readthedocs.org/en/latest/?badge=latest\n    :alt: Documentation Status\n\n.. image:: https://zenodo.org/badge/23078551.svg\n   :target: https://zenodo.org/badge/latestdoi/23078551\n\nCompatible with Python 3.7, and 3.8, 3.9\n\n\nWhat is it ?\n################\n\nThe **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.\n\nInstallation\n###################\n\n::\n\n    pip install fitter\n\n**fitter** is also available on **conda** (bioconda channel)::\n\n     conda install fitter\n\n\nUsage\n##################\n\nstandalone\n===========\n\nA standalone application (very simple) is also provided and works with input CSV\nfiles::\n\n    fitter fitdist data.csv --column-number 1 --distributions gamma,normal\n\nIt creates a file called fitter.png and a log fitter.log\n\nFrom Python shell\n==================\n\nFirst, let us create a data samples with N = 10,000 points from a gamma distribution::\n\n    from scipy import stats\n    data = stats.gamma.rvs(2, loc=1.5, scale=2, size=10000)\n\n.. note:: the fitting is slow so keep the size value to reasonable value.\n\nNow, 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::\n\n\n    from fitter import Fitter\n    f = Fitter(data)\n    f.fit()\n    # may take some time since by default, all distributions are tried\n    # but you call manually provide a smaller set of distributions\n    f.summary()\n\n\n.. image:: http://pythonhosted.org/fitter/_images/index-1.png\n    :target: http://pythonhosted.org/fitter/_images/index-1.png\n\n\nSee the `online <http://fitter.readthedocs.io/>`_ documentation for details.\n\n\nContributors\n=============\n\n\nSetting up and maintaining Fitter has been possible thanks to users and contributors.\nThanks to all:\n\n.. image:: https://contrib.rocks/image?repo=cokelaer/fitter\n    :target: https://github.com/cokelaer/fitter/graphs/contributors\n\n\n\n\nChangelog\n~~~~~~~~~\n========= ==========================================================================\nVersion   Description\n========= ==========================================================================\n1.7.1     * integrate PR github.com/cokelaer/fitter/pull/100 from @vitorandreazza\n            to speedup multiprocessing run.\n1.7.0     * replace logging with loguru\n          * main application update to add missing --output-image option and use\n            rich_click\n          * replace pkg_resources with importlib\n1.6.0     * for developers: uses pyproject.toml instead of setup.py\n          * Fix progress bar fixing https://github.com/cokelaer/fitter/pull/74\n          * Fix BIC formula https://github.com/cokelaer/fitter/pull/77\n1.5.2     * PR https://github.com/cokelaer/fitter/pull/74 to fix logger\n1.5.1     * fixed regression putting back joblib\n1.5.0     * removed easydev and replaced by tqdm for progress bar\n          * progressbar from tqdm also allows replacement of joblib need\n1.4.1     * Update timeout in docs from 10 to 30 seconds by @mpadge in\n            https://github.com/cokelaer/fitter/pull/47\n          * Add Kolmogorov-Smirnov goodness-of-fit statistic by @lahdjirayhan in\n            https://github.com/cokelaer/fitter/pull/58\n          * switch branch from master to main\n1.4.0     * get_best function now returns the parameters as a dictionary\n            of parameter names and their values rather than just a list of\n            values (https://github.com/cokelaer/fitter/issues/23) thanks to\n            contributor @kabirmdasraful\n          * Accepting PR to fix progress bar issue reported in\n            https://github.com/cokelaer/fitter/pull/37\n1.3.0     * parallel process implemented https://github.com/cokelaer/fitter/pull/25\n            thanks to @arsenyinfo\n1.2.3     * remove vervose arguments in Fitter class. Using the logging module\n            instead\n          * the Fitter.fit has now a progress bar\n          * add a standalone application called \u2026 fitter (see the doc)\n1.2.2     was not released\n1.2.1     adding new class called histfit (see documentation)\n1.2       * Fixed the version. Previous version switched from\n            1.0.9 to 1.1.11. To start a fresh version, we increase to 1.2.0\n          * Merged pull request required by bioconda\n          * Merged pull request related to implementation of\n            AIC/BIC/KL criteria (https://github.com/cokelaer/fitter/pull/19).\n            This also fixes https://github.com/cokelaer/fitter/issues/9\n          * Implement two functions to get all distributions, or a list of\n            common distributions to help users decreading computational time\n            (https://github.com/cokelaer/fitter/issues/20). Also added a FAQS\n            section.\n          * travis tested Python 3.6 and 3.7 (not 3.5 anymore)\n1.1       * Fixed deprecated warning\n          * fitter is now in readthedocs at fitter.readthedocs.io\n1.0.9     * https://github.com/cokelaer/fitter/pull/8 and 11\n            PR https://github.com/cokelaer/fitter/pull/8\n1.0.6     * summary() now returns the dataframe (instead of printing it)\n1.0.5      https://github.com/cokelaer/fitter/issues\n1.0.2     add manifest to fix missing source in the pypi repository.\n========= ==========================================================================\n",
    "bugtrack_url": null,
    "license": "GPL",
    "summary": "A tool to fit data to many distributions and get the best one(s)",
    "version": "1.7.1",
    "project_urls": null,
    "split_keywords": [
        "fit",
        " distribution",
        " fitting",
        " scipy"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f920e0526cff78b376e74f9e153d66b946650068bc9ff24864023a85ec963f99",
                "md5": "ac402e745f87bf7f51da1a17f80b4bae",
                "sha256": "f8419787482a4964ad33839277f056e07d08e436f7d125e713aa886403e4ad05"
            },
            "downloads": -1,
            "filename": "fitter-1.7.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ac402e745f87bf7f51da1a17f80b4bae",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.8",
            "size": 26252,
            "upload_time": "2024-06-24T08:50:57",
            "upload_time_iso_8601": "2024-06-24T08:50:57.396301Z",
            "url": "https://files.pythonhosted.org/packages/f9/20/e0526cff78b376e74f9e153d66b946650068bc9ff24864023a85ec963f99/fitter-1.7.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fae243c5db5bd54ab13b6535859f01e340e19e775fe0b78c299966948cfca089",
                "md5": "bdb812450ae863b7bff7648037f11446",
                "sha256": "d9df8885f106d911c3a7ed97949b3cf3c29ec2464c529244f2434738dd6b0e50"
            },
            "downloads": -1,
            "filename": "fitter-1.7.1.tar.gz",
            "has_sig": false,
            "md5_digest": "bdb812450ae863b7bff7648037f11446",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.8",
            "size": 26535,
            "upload_time": "2024-06-24T08:50:58",
            "upload_time_iso_8601": "2024-06-24T08:50:58.762062Z",
            "url": "https://files.pythonhosted.org/packages/fa/e2/43c5db5bd54ab13b6535859f01e340e19e775fe0b78c299966948cfca089/fitter-1.7.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-06-24 08:50:58",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "fitter"
}
        
Elapsed time: 0.25381s