metalogistic


Namemetalogistic JSON
Version 0.0.12 PyPI version JSON
download
home_pagehttps://github.com/tadamcz/metalogistic
SummaryA Python package for the metalogistic distribution. The metalogistic or metalog distribution is a highly flexible probability distribution that can be used to model data without traditional parameters.
upload_time2023-07-06 10:44:29
maintainer
docs_urlNone
authorTom Adamczewski
requires_python>=3.8,<4.0
licenseGNU Affero General Public License v3
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # The metalog distribution
This package is a Python implementation of the **metalogistic or metalog** distribution,
as described in [Keelin 2016][k2016].

The metalog is a continuous univariate probability distribution that can be used to model data without traditional parameters.
Instead, the distribution is parametrized by **points on a cumulative distribution function (CDF)**, and the CDF of the
metalog fitted to these input points usually passes through them exactly.
The distribution can take almost any shape.

The distribution is well suited to **eliciting full subjective probability distributions** from a few
 CDF points. If used in this way, the result is a distribution that fits these points closely, without
 imposing strong shape constraints (as would be the case if fitting to a traditional distribution like the 
 normal or lognormal). [Keelin 2016][k2016] remarks that the metalog "can be used for real-time feedback to experts
 about the implications of their probability assessments".

See also the website [metalogdistributions.com](http://www.metalogdistributions.com/).

[k2016]: http://www.metalogdistributions.com/images/The_Metalog_Distributions_-_Keelin_2016.pdf

# This package
This package:
* Provides an object-oriented interface to instances of the class `MetaLogistic`
* Defines `MetaLogistic` as a subclass of SciPy [continuous distribution objects](https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.rv_continuous.html),
which lets us use their many convenient, performant methods.
* Uses numerical methods to approximate a least-squares fit if the closed-form method described in Keelin 2016 fails.
 This allows us to fit an even wider range of CDF data. 
* Is fast (see `timings.py`).
 

# Usage

```python
from metalogistic import MetaLogistic

my_metalog = MetaLogistic(cdf_xs=[-5, 2, 20], cdf_ps=[.35, .5, .95])

# These methods can take scalars or arrays/lists/vectors
my_metalog.cdf(10)
my_metalog.pdf([10, 20, 21])
my_metalog.quantile([0.8, .99])

# Take random samples
my_metalog.rvs(size=10)

# These methods conveniently display useful information
my_metalog.print_summary()
my_metalog.display_plot()
```

# Installation 
```
pip install metalogistic
```

# Speed
`timings.py`

When using linear least squares:
```
#### Speed test ####
Data:
cdf_ps [0.15, 0.5, 0.9]
cdf_xs [-20, -1, 40]
Bounds: None None

Timings:
'doFit'  3.99 ms
'createPlotData'  3.99 ms
```

When we are forced to use numerical fitting methods:
```
#### Speed test ####
Data:
cdf_ps [0.15, 0.5, 0.9]
cdf_xs [-20, -1, 100]
Bounds: None 1000

Timings:
'doFit'  345.08 ms
'createPlotData'  4.98 ms

#### Speed test ####
Data:
cdf_ps [0.15, 0.5, 0.9]
cdf_xs [-20, -1, 100]
Bounds: None None

Timings:
'doFit'  354.57 ms
'createPlotData'  5.98 ms
```

# License
If AGPL is a problem for you, please [contact me](https://tadamcz.com/). As I am currently the sole author, we can probably work something out.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/tadamcz/metalogistic",
    "name": "metalogistic",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8,<4.0",
    "maintainer_email": "",
    "keywords": "",
    "author": "Tom Adamczewski",
    "author_email": "tadamczewskipublic@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/96/39/39207b30a87f911ceda09dd90f465af1987aa83b1b01e27d30aed01c5a68/metalogistic-0.0.12.tar.gz",
    "platform": null,
    "description": "# The metalog distribution\nThis package is a Python implementation of the **metalogistic or metalog** distribution,\nas described in [Keelin 2016][k2016].\n\nThe metalog is a continuous univariate probability distribution that can be used to model data without traditional parameters.\nInstead, the distribution is parametrized by **points on a cumulative distribution function (CDF)**, and the CDF of the\nmetalog fitted to these input points usually passes through them exactly.\nThe distribution can take almost any shape.\n\nThe distribution is well suited to **eliciting full subjective probability distributions** from a few\n CDF points. If used in this way, the result is a distribution that fits these points closely, without\n imposing strong shape constraints (as would be the case if fitting to a traditional distribution like the \n normal or lognormal). [Keelin 2016][k2016] remarks that the metalog \"can be used for real-time feedback to experts\n about the implications of their probability assessments\".\n\nSee also the website [metalogdistributions.com](http://www.metalogdistributions.com/).\n\n[k2016]: http://www.metalogdistributions.com/images/The_Metalog_Distributions_-_Keelin_2016.pdf\n\n# This package\nThis package:\n* Provides an object-oriented interface to instances of the class `MetaLogistic`\n* Defines `MetaLogistic` as a subclass of SciPy [continuous distribution objects](https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.rv_continuous.html),\nwhich lets us use their many convenient, performant methods.\n* Uses numerical methods to approximate a least-squares fit if the closed-form method described in Keelin 2016 fails.\n This allows us to fit an even wider range of CDF data. \n* Is fast (see `timings.py`).\n \n\n# Usage\n\n```python\nfrom metalogistic import MetaLogistic\n\nmy_metalog = MetaLogistic(cdf_xs=[-5, 2, 20], cdf_ps=[.35, .5, .95])\n\n# These methods can take scalars or arrays/lists/vectors\nmy_metalog.cdf(10)\nmy_metalog.pdf([10, 20, 21])\nmy_metalog.quantile([0.8, .99])\n\n# Take random samples\nmy_metalog.rvs(size=10)\n\n# These methods conveniently display useful information\nmy_metalog.print_summary()\nmy_metalog.display_plot()\n```\n\n# Installation \n```\npip install metalogistic\n```\n\n# Speed\n`timings.py`\n\nWhen using linear least squares:\n```\n#### Speed test ####\nData:\ncdf_ps [0.15, 0.5, 0.9]\ncdf_xs [-20, -1, 40]\nBounds: None None\n\nTimings:\n'doFit'  3.99 ms\n'createPlotData'  3.99 ms\n```\n\nWhen we are forced to use numerical fitting methods:\n```\n#### Speed test ####\nData:\ncdf_ps [0.15, 0.5, 0.9]\ncdf_xs [-20, -1, 100]\nBounds: None 1000\n\nTimings:\n'doFit'  345.08 ms\n'createPlotData'  4.98 ms\n\n#### Speed test ####\nData:\ncdf_ps [0.15, 0.5, 0.9]\ncdf_xs [-20, -1, 100]\nBounds: None None\n\nTimings:\n'doFit'  354.57 ms\n'createPlotData'  5.98 ms\n```\n\n# License\nIf AGPL is a problem for you, please [contact me](https://tadamcz.com/). As I am currently the sole author, we can probably work something out.\n",
    "bugtrack_url": null,
    "license": "GNU Affero General Public License v3",
    "summary": "A Python package for the metalogistic distribution. The metalogistic or metalog distribution is a highly flexible probability distribution that can be used to model data without traditional parameters.",
    "version": "0.0.12",
    "project_urls": {
        "Homepage": "https://github.com/tadamcz/metalogistic",
        "Repository": "https://github.com/tadamcz/metalogistic"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4d729c0e2a22ae7bc82f115462ba9eda041163b81a4762eb04386ea57a974876",
                "md5": "7fe69b0ea8e3a599b99208093152507a",
                "sha256": "c40e972ed7ae31718db5a4a2e9a9d69a62fc641731930cfdcf8af61fb3ff0451"
            },
            "downloads": -1,
            "filename": "metalogistic-0.0.12-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7fe69b0ea8e3a599b99208093152507a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8,<4.0",
            "size": 24155,
            "upload_time": "2023-07-06T10:44:26",
            "upload_time_iso_8601": "2023-07-06T10:44:26.828224Z",
            "url": "https://files.pythonhosted.org/packages/4d/72/9c0e2a22ae7bc82f115462ba9eda041163b81a4762eb04386ea57a974876/metalogistic-0.0.12-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "963939207b30a87f911ceda09dd90f465af1987aa83b1b01e27d30aed01c5a68",
                "md5": "7f15059dfbb0c0ebccbc6bca407574a1",
                "sha256": "6aee0d56eb425e8dff264a433f9dac738fc7d0cdf00c982628a396ef2c73184f"
            },
            "downloads": -1,
            "filename": "metalogistic-0.0.12.tar.gz",
            "has_sig": false,
            "md5_digest": "7f15059dfbb0c0ebccbc6bca407574a1",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8,<4.0",
            "size": 24305,
            "upload_time": "2023-07-06T10:44:29",
            "upload_time_iso_8601": "2023-07-06T10:44:29.738477Z",
            "url": "https://files.pythonhosted.org/packages/96/39/39207b30a87f911ceda09dd90f465af1987aa83b1b01e27d30aed01c5a68/metalogistic-0.0.12.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-07-06 10:44:29",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "tadamcz",
    "github_project": "metalogistic",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "metalogistic"
}
        
Elapsed time: 0.08566s