{ "info": { "author": "Matthieu Marinangeli", "author_email": "matthieu.marinangeli@cern.ch", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "Intended Audience :: Science/Research", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Topic :: Scientific/Engineering" ], "description": "# scikit-stats: statistics tools and utilities\n\n[![Build Status](https://dev.azure.com/matthieumarinangeli/matthieumarinangeli/_apis/build/status/scikit-hep.scikit-stats?branchName=master)](https://dev.azure.com/matthieumarinangeli/matthieumarinangeli/_build/latest?definitionId=3&branchName=master)\n![Azure DevOps tests](https://img.shields.io/azure-devops/tests/matthieumarinangeli/matthieumarinangeli/3)\n![Azure DevOps coverage](https://img.shields.io/azure-devops/coverage/matthieumarinangeli/matthieumarinangeli/3)\n[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/scikit-hep/scikit-stats/master)\n[![PyPI](https://img.shields.io/pypi/v/scikit-stats)](https://pypi.org/project/scikit-stats/)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/scikit-stats)](https://pypi.org/project/scikit-stats/)\n[![DOI](https://zenodo.org/badge/191397511.svg)](https://zenodo.org/badge/latestdoi/191397511)\n\n## Installation\n\nInstall `scikit-stats` like any other Python package:\n\n```\npip install scikit-stats\n```\n\nor similar (use `--user`, `virtualenv`, etc. if you wish).\n\n## Getting Started\n\nThe `scikit-stats` module includes modeling and hypothesis tests submodules. This a quick user guide to each submodule. The [binder](https://mybinder.org/v2/gh/scikit-hep/scikit-stats/master) examples are also a good way to get started.\n\n### modeling\n\nThe modeling submodule includes the [Bayesian Block algorithm](https://arxiv.org/pdf/1207.5578.pdf) that can be used to improve the binning of histograms. The visual improvement can be dramatic, and more importantly, this algorithm produces histograms that accurately represent the underlying distribution while being robust to statistical fluctuations. Here is a small example of the algorithm applied on Laplacian sampled data, compared to a histogram of this sample with a fine binning.\n\n```python\n>>> import numpy as np\n>>> import matplotlib.pyplot as plt\n>>> from skstats.modeling import bayesian_blocks\n\n>>> data = np.random.laplace(size=10000)\n>>> blocks = bayesian_blocks(data)\n\n>>> plt.hist(data, bins=1000, label='Fine Binning', density=True, alpha=0.6)\n>>> plt.hist(data, bins=blocks, label='Bayesian Blocks', histtype='step', density=True, linewidth=2)\n>>> plt.legend(loc=2)\n```\n\n![bayesian blocks example](https://raw.githubusercontent.com/scikit-hep/scikit-stats/master/notebooks/modeling/bayesian_blocks_example.png)\n\n### hypotests\n\nThis submodule provides tools to do hypothesis tests such as discovery test and computations of upper limits or confidence intervals. scikit-stats needs a fitting backend to perform computations such as [zfit](https://github.com/zfit/zfit). Any fitting library can be used if their API is compatible with scikit-stats (see [api checks](https://github.com/scikit-hep/scikit-stats/blob/master/skstats/hypotests/fitutils/api_check.py)).\n\nWe give here a simple example of a discovery test, using [zfit](https://github.com/zfit/zfit) as backend, of gaussian signal with known mean and sigma over an exponential background.\n\n```python\n>>> import zfit\n>>> from zfit.loss import ExtendedUnbinnedNLL\n>>> from zfit.minimize import Minuit\n\n>>> bounds = (0.1, 3.0)\n>>> obs = zfit.Space('x', limits=bounds)\n\n>>> bkg = np.random.exponential(0.5, 300)\n>>> peak = np.random.normal(1.2, 0.1, 25)\n>>> data = np.concatenate((bkg, peak))\n>>> data = data[(data > bounds[0]) & (data < bounds[1])]\n>>> N = data.size\n>>> data = zfit.Data.from_numpy(obs=obs, array=data)\n\n>>> lambda_ = zfit.Parameter(\"lambda\", -2.0, -4.0, -1.0)\n>>> Nsig = zfit.Parameter(\"Ns\", 20., -20., N)\n>>> Nbkg = zfit.Parameter(\"Nbkg\", N, 0., N*1.1)\n>>> signal = Nsig * zfit.pdf.Gauss(obs=obs, mu=1.2, sigma=0.1)\n>>> background = Nbkg * zfit.pdf.Exponential(obs=obs, lambda_=lambda_)\n>>> loss = ExtendedUnbinnedNLL(model=signal + background, data=data)\n\n>>> from skstats.hypotests.calculators import AsymptoticCalculator\n>>> from skstats.hypotests import Discovery\n>>> from skstats.hypotests.parameters import POI\n\n>>> calculator = AsymptoticCalculator(loss, Minuit())\n>>> poinull = POI(Nsig, 0)\n>>> discovery_test = Discovery(calculator, [poinull])\n>>> discovery_test.result()\n\np_value for the Null hypothesis = 0.0007571045424956679\nSignificance (in units of sigma) = 3.1719464825102244\n```\n\nThe discovery test prints out the pvalue and the significance of the null hypothesis to be rejected.\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/scikit-hep/scikit-stats", "keywords": "HEP,statistics", "license": "BSD 3-Clause License", "maintainer": "The Scikit-HEP admins", "maintainer_email": "scikit-hep-admins@googlegroups.com", "name": "scikit-stats", "package_url": "https://pypi.org/project/scikit-stats/", "platform": "Any", "project_url": "https://pypi.org/project/scikit-stats/", "project_urls": { "Homepage": "https://github.com/scikit-hep/scikit-stats" }, "release_url": "https://pypi.org/project/scikit-stats/0.1.2/", "requires_dist": [ "scipy", "numpy", "pandas" ], "requires_python": "!=2.*, >=3.6", "summary": "statistics tools and utilities", "version": "0.1.2", "yanked": false, "yanked_reason": null }, "last_serial": 6117314, "releases": { "0.0.0": [ { "comment_text": "", "digests": { "md5": "c865e495343297b98e47548e08545810", "sha256": "d622d04597c622ddd24c6501f4726da21afed394bf533c3f92d8302bbe0bd7fd" }, "downloads": -1, "filename": "scikit-stats-0.0.0.tar.gz", "has_sig": false, "md5_digest": "c865e495343297b98e47548e08545810", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4562, "upload_time": "2019-07-04T12:33:04", "upload_time_iso_8601": "2019-07-04T12:33:04.137233Z", "url": "https://files.pythonhosted.org/packages/58/7a/9566a21f04dda578c71d1ce54d1d47fd056f0f951ab6470ed87753dc994d/scikit-stats-0.0.0.tar.gz", "yanked": false, "yanked_reason": null } ], "0.1.0": [ { "comment_text": "", "digests": { "md5": "ecb27829fa1d148a60461d807a8843ed", "sha256": "e88f4d7454fc089fd7804541c24c05fcfb3b16b8b1189f820d2ac85f209e09f2" }, "downloads": -1, "filename": "scikit_stats-0.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "ecb27829fa1d148a60461d807a8843ed", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 28590, "upload_time": "2019-10-25T12:41:14", "upload_time_iso_8601": "2019-10-25T12:41:14.510151Z", "url": "https://files.pythonhosted.org/packages/15/75/217d177bfcca61f0e0736c6f1345de5f93102cf29032b8dca64342abad22/scikit_stats-0.1.0-py2.py3-none-any.whl", "yanked": false, "yanked_reason": null }, { "comment_text": "", "digests": { "md5": "40912d88392476c30c36220ef5af012d", "sha256": "a82e8f6eadfe6f592a0777f90b8b9988745dc2749a0d7f08d66653e657091d37" }, "downloads": -1, "filename": "scikit-stats-0.1.0.tar.gz", "has_sig": false, "md5_digest": "40912d88392476c30c36220ef5af012d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14413, "upload_time": "2019-10-25T12:41:15", "upload_time_iso_8601": "2019-10-25T12:41:15.904321Z", "url": "https://files.pythonhosted.org/packages/bd/37/0c6cdd5d130edcde22985563a599f7e45589ecc32238a9db017a14c829ce/scikit-stats-0.1.0.tar.gz", "yanked": false, "yanked_reason": null } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "1338f377d056b62741df0c52c0dd62e2", "sha256": "9d4cf9af021bddc1ea168df89ef6f2885bf2dbf8ed4591cb6a79939dc379cf50" }, "downloads": -1, "filename": "scikit-stats-0.1.1.tar.gz", "has_sig": false, "md5_digest": "1338f377d056b62741df0c52c0dd62e2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14616, "upload_time": "2019-10-25T13:37:21", "upload_time_iso_8601": "2019-10-25T13:37:21.035065Z", "url": "https://files.pythonhosted.org/packages/7b/f7/2205d0f011dcb50791554c31aa1492089850285ce00cde829b186d715cad/scikit-stats-0.1.1.tar.gz", "yanked": false, "yanked_reason": null } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "4c2b3d8f04dfc506ca0aca400aa6e495", "sha256": "d31e1bf9f2f1f22054004be8e680a56695554ec732a51c056d4cc6513b2f7eed" }, "downloads": -1, "filename": "scikit_stats-0.1.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "4c2b3d8f04dfc506ca0aca400aa6e495", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": "!=2.*, >=3.6", "size": 24608, "upload_time": "2019-11-11T14:35:41", "upload_time_iso_8601": "2019-11-11T14:35:41.436473Z", "url": "https://files.pythonhosted.org/packages/be/d7/58aab05cec63439787c3e6b1cc458197382e83b7b709ac5baddb7d103c17/scikit_stats-0.1.2-py2.py3-none-any.whl", "yanked": false, "yanked_reason": null }, { "comment_text": "", "digests": { "md5": "e4528bd3c29a1d83b828ad37986dfa40", "sha256": "e38ca051873bcebfec88f7b329eb546862469ca08088ea4380a316d5cec6d25e" }, "downloads": -1, "filename": "scikit-stats-0.1.2.tar.gz", "has_sig": false, "md5_digest": "e4528bd3c29a1d83b828ad37986dfa40", "packagetype": "sdist", "python_version": "source", "requires_python": "!=2.*, >=3.6", "size": 16654, "upload_time": "2019-11-11T14:35:43", "upload_time_iso_8601": "2019-11-11T14:35:43.180506Z", "url": "https://files.pythonhosted.org/packages/4d/22/e4d823bfd16b44e6c4f7a42dde478d50c34d5c0507e1d185411a633c2d90/scikit-stats-0.1.2.tar.gz", "yanked": false, "yanked_reason": null } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "4c2b3d8f04dfc506ca0aca400aa6e495", "sha256": "d31e1bf9f2f1f22054004be8e680a56695554ec732a51c056d4cc6513b2f7eed" }, "downloads": -1, "filename": "scikit_stats-0.1.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "4c2b3d8f04dfc506ca0aca400aa6e495", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": "!=2.*, >=3.6", "size": 24608, "upload_time": "2019-11-11T14:35:41", "upload_time_iso_8601": "2019-11-11T14:35:41.436473Z", "url": "https://files.pythonhosted.org/packages/be/d7/58aab05cec63439787c3e6b1cc458197382e83b7b709ac5baddb7d103c17/scikit_stats-0.1.2-py2.py3-none-any.whl", "yanked": false, "yanked_reason": null }, { "comment_text": "", "digests": { "md5": "e4528bd3c29a1d83b828ad37986dfa40", "sha256": "e38ca051873bcebfec88f7b329eb546862469ca08088ea4380a316d5cec6d25e" }, "downloads": -1, "filename": "scikit-stats-0.1.2.tar.gz", "has_sig": false, "md5_digest": "e4528bd3c29a1d83b828ad37986dfa40", "packagetype": "sdist", "python_version": "source", "requires_python": "!=2.*, >=3.6", "size": 16654, "upload_time": "2019-11-11T14:35:43", "upload_time_iso_8601": "2019-11-11T14:35:43.180506Z", "url": "https://files.pythonhosted.org/packages/4d/22/e4d823bfd16b44e6c4f7a42dde478d50c34d5c0507e1d185411a633c2d90/scikit-stats-0.1.2.tar.gz", "yanked": false, "yanked_reason": null } ], "vulnerabilities": [] }