{ "info": { "author": "Steve Howard", "author_email": "dev@gostevehoward.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Science/Research", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: C++", "Programming Language :: Python :: 3", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Scientific/Engineering :: Mathematics" ], "description": "# Confidence sequences and uniform boundaries\n\nThis library supports calculation of uniform boundaries, confidence sequences,\nand always-valid p-values. These constructs are useful in sequential A/B\ntesting, best-arm identification, and other sequential statistical\nprocedures. The main reference is\n\nS. R. Howard, A. Ramdas, J. McAuliffe, J. Sekhon. [Uniform, nonparametric,\nnon-asymptotic confidence\nsequences](https://arxiv.org/abs/1810.08240). Preprint, arXiv:1810.08240.\n\nAdditionally, the library includes some functions for quantile confidence\nsequences and A/B testing based on\n\nS. R. Howard, A. Ramdas. [Sequential estimation of quantiles with applications\nto A/B-testing and best-arm\nidentification](https://arxiv.org/abs/1906.09712). Preprint, arXiv:1906.09712.\n\nThis library is in early-stage development and should not be considered\nstable. I have tested it only on Python 3.7.0 on macOS Mojave. The\nimplementation is in C++ and a compiler with C++14 support is required to build\nthe package.\n\n## Installing the python package\n\nRun `pip3 install confseq`.\n\n## Demos\n\n### Estimating average treatment effect in a randomized trial\n\n`demo/ate_demo.py` illustrates how to compute a confidence sequence for average\ntreatment effect in a randomized trial with bounded potential outcomes, along\nwith an always-valid p-value sequence. The method is based on Corollary 2 of the\npaper and uses the gamma-exponential mixture boundary. This demo requires\n`numpy` and `pandas`.\n\n### Quantile confidence sequences\n\n`demo/quantiles.py` illustrates how to use some of the included boundaries to\nconstruct confidence sequences for quantiles based on a stream of\ni.i.d. samples. The file includes a function to estimate a single, fixed\nquantile, as well as a function to estimate all quantiles simultaneously, with\nerror control uniform over quantiles and time.\n\n## Uniform boundaries\n\nThe `confseq.boundaries` module implements several uniform boundaries from the\nconfidence sequences paper.\n\n* There are four mixture boundaries. These are implemented by the functions\n `_log_mixture()` and `_mixture_bound()`, where `` is one of\n `normal` (Propositions 4 and 5), `gamma_exponential` (Proposition 8),\n `gamma_poisson` (Proposition 9), or `beta_binomial` (Propositions 6 and 7).\n * `_log_mixture(s, v, ...)` returns the logarithm of the mixture\n supermartingale when called with S\\_t, the martingale, and V\\_t, the\n intrinsic time process. The reciprocal of the exponential of this value is\n an always-valid p-value. These functions are denoted log(m(s,v)) in the\n paper.\n * `_mixture_bound(v, alpha, ...)` returns the uniform boundary with\n crossing probability at most alpha, evaluated at intrinsic time v.\n\n Each function takes another required argument `v_opt` and an optional\n argument `alpha_opt=0.05`. These arguments are used to set the tuning\n parameter for each mixture, denoted by rho or r in the paper, optimizing the\n uniform boundary with crossing probability `alpha_opt` for intrinsic time\n `v_opt`. Such tuning is discussed in section 3.5 of the paper.\n\n The gamma-exponential and gamma-Poisson mixtures also require a scale\n parameter `c`. The beta-binomial mixture requires range parameters `g` and\n `h`. Finally, the `normal_*` and `beta_binomial_*` functions accept an\n optional boolean parameter `is_one_sided` which is `True` by default. If\n `False`, the two-sided variants of these mixtures are used (Propositions 4\n and 6).\n* The polynomial stitching boundary (see Theorem 1 and the subsequent example)\n is implemented by `poly_stitching_bound`. Besides `v` and `alpha`, this\n function requires the tuning parameter `v_min` as well as optional parameters\n `c`, `s`, and `eta`, all documented in the paper.\n* This module also includes a `bernoulli_confidence_sequence` function which\n computes confidence sequences for the mean of any distribution with bounded\n support by making use of the sub-Bernoulli condition. Observations must be\n scaled so that the support is within the unit interval [0, 1].\n\nAll functions accept NumPy arrays and perform vectorized operations.\n\n## Quantile bounds\n\nThe `confseq.quantiles` module implements two quantile-uniform confidence\nsequences from the quantile paper.\n\n* `empirical_process_lil_bound` is based on Theorem 2, and can be used to\n construct iterated-logarithm-rate confidence sequences for quantiles in which\n the confidence radius (in quantile space) is constant for all quantiles. This\n can also be used run the sequential Kolmogorov-Smirnov test described in\n section 7.2.\n* `double_stitching_bound` is based on Theorem 3, and can be used to construct\n confidence sequences for quantiles in which the confidence radius (in quantile\n space) varies, getting smaller for extreme quantiles close to zero and one.\n\nFinally, `quantile_ab_p_value` implements the two-sided sequential test of the\nhypothesis that two populations have equal values for some quantile, based on\nTheorem 5. The theorem covers tests of null hypothesis other than equality, as\nwell as one-sided tests, but these are not yet implemented.\n\n## C++ library\n\nThe underlying implementation is in a single-file, header-only C++ library in\n`src/confseq/uniform_boundaries.h`. The top of the file defines a simplified\ninterface mirroring the Python interface described above. Below that is an\nobject-oriented interface useful for more involved work. The\n`confseq.boundaries` Python module is a wrapper generated by\n[pybind11](https://github.com/pybind/pybind11).\n\n## Unit tests\n\nRun `make -C /path/to/confseq/tests runtests` to run the C++ unit tests.\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/gostevehoward/confseq", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "confseq", "package_url": "https://pypi.org/project/confseq/", "platform": "", "project_url": "https://pypi.org/project/confseq/", "project_urls": { "Homepage": "https://github.com/gostevehoward/confseq" }, "release_url": "https://pypi.org/project/confseq/0.0.4/", "requires_dist": [ "pybind11 (>=2.3)", "numpy" ], "requires_python": "", "summary": "Confidence sequences and uniform boundaries", "version": "0.0.4" }, "last_serial": 5629233, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "af24ae7fefb8255abd2b0a58d2240ec2", "sha256": "af0247af0658abb3f5f1f9bccd06fe34af2025d38fe2e504dfce142edb2606c1" }, "downloads": -1, "filename": "confseq-0.0.1-cp37-cp37m-macosx_10_13_x86_64.whl", "has_sig": false, "md5_digest": "af24ae7fefb8255abd2b0a58d2240ec2", "packagetype": "bdist_wheel", "python_version": "cp37", "requires_python": null, "size": 133882, "upload_time": "2019-07-30T21:21:00", "url": "https://files.pythonhosted.org/packages/68/b7/69e3ab7074d591cf11ce9dd3e46191bd24bd1251d44444da182594b4b8f8/confseq-0.0.1-cp37-cp37m-macosx_10_13_x86_64.whl" }, { "comment_text": "", "digests": { "md5": "0f5dc1cbc05fb8cd86b67526fcd63383", "sha256": "40523440be70b99882c981366995a4a462e711691528455f80719133a802d1f9" }, "downloads": -1, "filename": "confseq-0.0.1.tar.gz", "has_sig": false, "md5_digest": "0f5dc1cbc05fb8cd86b67526fcd63383", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4955, "upload_time": "2019-07-30T21:21:03", "url": "https://files.pythonhosted.org/packages/32/48/eefb9297c5156e5401ce90c1073510c3f6a7177e3927d531684927c48276/confseq-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "b49461923e48129ce16287edda58688b", "sha256": "4c6702dca6d0c97f6cb0f40d4c69824cf7e1fa30ba6bec8f9895e0edf591cefa" }, "downloads": -1, "filename": "confseq-0.0.2-cp37-cp37m-macosx_10_13_x86_64.whl", "has_sig": false, "md5_digest": "b49461923e48129ce16287edda58688b", "packagetype": "bdist_wheel", "python_version": "cp37", "requires_python": null, "size": 164104, "upload_time": "2019-08-03T03:07:50", "url": "https://files.pythonhosted.org/packages/a8/2f/15a701b8adcf9f7904e18ef49f0209fd15b86d1cc58fc53e6d3d6d6e833c/confseq-0.0.2-cp37-cp37m-macosx_10_13_x86_64.whl" }, { "comment_text": "", "digests": { "md5": "47884d7366536d6646cd7254bcf168b1", "sha256": "2c3cef97dca4ecb716963a95ddf76706725a61e76d336d4e1282ba3a86b954a6" }, "downloads": -1, "filename": "confseq-0.0.2.tar.gz", "has_sig": false, "md5_digest": "47884d7366536d6646cd7254bcf168b1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5086, "upload_time": "2019-08-03T03:07:52", "url": "https://files.pythonhosted.org/packages/42/79/aaa37e70e7a1348a803c4bbf9451a380e9a19a5767a5029ea010c7046c37/confseq-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "4674f9b080a5872263e2d9ecd285bf0c", "sha256": "8c2cfdf0701861e692ecc72e909b3d021716afa881db956fbdfbb77a8010e9f3" }, "downloads": -1, "filename": "confseq-0.0.3-cp37-cp37m-macosx_10_13_x86_64.whl", "has_sig": false, "md5_digest": "4674f9b080a5872263e2d9ecd285bf0c", "packagetype": "bdist_wheel", "python_version": "cp37", "requires_python": null, "size": 315931, "upload_time": "2019-08-03T03:15:24", "url": "https://files.pythonhosted.org/packages/68/89/be269184353705643dfffe643aed78642ae685e71b77b2e701b3a7c822ae/confseq-0.0.3-cp37-cp37m-macosx_10_13_x86_64.whl" }, { "comment_text": "", "digests": { "md5": "c4d7ffd3c5b7000ad3ec8b67b43f11b3", "sha256": "e4300b7b1a6fd66a3e49cd7d82c34d51ac1c4562cfd3f8d3fab05bfd55fc230b" }, "downloads": -1, "filename": "confseq-0.0.3.tar.gz", "has_sig": false, "md5_digest": "c4d7ffd3c5b7000ad3ec8b67b43f11b3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6452, "upload_time": "2019-08-03T03:15:28", "url": "https://files.pythonhosted.org/packages/ff/cb/653cf5f485c57c890d4529fe7d4eea1e3b6689b04d6dc45868a1477586e0/confseq-0.0.3.tar.gz" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "8891f899b94e82f09b4632921b27d837", "sha256": "6cdb20797f1708b07e562d377ba26fba6c4dad5d0961a18b82bd34905444219d" }, "downloads": -1, "filename": "confseq-0.0.4-cp37-cp37m-macosx_10_13_x86_64.whl", "has_sig": false, "md5_digest": "8891f899b94e82f09b4632921b27d837", "packagetype": "bdist_wheel", "python_version": "cp37", "requires_python": null, "size": 328531, "upload_time": "2019-08-03T21:44:59", "url": "https://files.pythonhosted.org/packages/ae/4a/0595f7ec3f2c04ac9a8144803d4bf672698c2e618c8bdbf7f7a405464946/confseq-0.0.4-cp37-cp37m-macosx_10_13_x86_64.whl" }, { "comment_text": "", "digests": { "md5": "83cb1858fd37d94a98d6dd951d9055f9", "sha256": "182fe4e6858cf1ad7430069fc55dd1be96602ba9748521b73b271ab50927d5f6" }, "downloads": -1, "filename": "confseq-0.0.4.tar.gz", "has_sig": false, "md5_digest": "83cb1858fd37d94a98d6dd951d9055f9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6814, "upload_time": "2019-08-03T21:45:01", "url": "https://files.pythonhosted.org/packages/87/27/e5b20c31676186fb6fa1c21214050571ac7416f99a6956f4c625675a9156/confseq-0.0.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "8891f899b94e82f09b4632921b27d837", "sha256": "6cdb20797f1708b07e562d377ba26fba6c4dad5d0961a18b82bd34905444219d" }, "downloads": -1, "filename": "confseq-0.0.4-cp37-cp37m-macosx_10_13_x86_64.whl", "has_sig": false, "md5_digest": "8891f899b94e82f09b4632921b27d837", "packagetype": "bdist_wheel", "python_version": "cp37", "requires_python": null, "size": 328531, "upload_time": "2019-08-03T21:44:59", "url": "https://files.pythonhosted.org/packages/ae/4a/0595f7ec3f2c04ac9a8144803d4bf672698c2e618c8bdbf7f7a405464946/confseq-0.0.4-cp37-cp37m-macosx_10_13_x86_64.whl" }, { "comment_text": "", "digests": { "md5": "83cb1858fd37d94a98d6dd951d9055f9", "sha256": "182fe4e6858cf1ad7430069fc55dd1be96602ba9748521b73b271ab50927d5f6" }, "downloads": -1, "filename": "confseq-0.0.4.tar.gz", "has_sig": false, "md5_digest": "83cb1858fd37d94a98d6dd951d9055f9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6814, "upload_time": "2019-08-03T21:45:01", "url": "https://files.pythonhosted.org/packages/87/27/e5b20c31676186fb6fa1c21214050571ac7416f99a6956f4c625675a9156/confseq-0.0.4.tar.gz" } ] }