Skip to main content

A POC for a combinatorial probability library using integer partitions as one example

Project description

Why?

This library was created to perform operations like iterating or random sampling of combinatorial structures like integer partition, permutations, set partitions etc.

What?

Right now only integer partitions are implemented, minimally. One can randomly sample using several different methods.

Example

from CombinatorialProbability import IntegerPartition
ip = IntegerPartition()
ip.fit(weight=10, make_array=True, make_table=True, make_tilt=True)
ip.sampling(size=10, method='rejection')

Right now sample returns a tuple, the first element is the sample, the second element is the number of iterations before a successful sample was found, by default it is a list of all 1s if a method is not a rejection method.

Other arguments for method are:

  • pdcdsh -- Probabilistic divide-and-conquer deterministic second half
  • table_only -- The (tabular) recursive method of Nijenhuis--Wilf
  • array_only -- The (array) recursive method of Nijenhuis--Wilf
  • pdc-recursive -- Probabilistic divide-and-conquer combined with the table method of Nijenhuis--Wilf

Additional parameters for a given method should be in the form of a dictionary method_params = {} also input to the sample() method.

ip.sampling(size=10, method='pdcdsh')
ip.sampling(size=10, method='table_only')
ip.sampling(size=10, method='array_only')
ip.sampling(size=10, method='pdc-recursive', method_params={'rows': 3})

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

CombinatorialProbability-0.0.3.tar.gz (12.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

CombinatorialProbability-0.0.3-py3-none-any.whl (18.7 kB view details)

Uploaded Python 3

File details

Details for the file CombinatorialProbability-0.0.3.tar.gz.

File metadata

  • Download URL: CombinatorialProbability-0.0.3.tar.gz
  • Upload date:
  • Size: 12.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6

File hashes

Hashes for CombinatorialProbability-0.0.3.tar.gz
Algorithm Hash digest
SHA256 9a2a350bd43e5fd15f2377cf8793b6d79dabd55668d77151b2cfc193099cdbd5
MD5 701dc4e2ddd6adf30138576b9b619121
BLAKE2b-256 e7bdb0e8850d37ed76927a076f408002318bb93b4d24176764c4f7e24be308ac

See more details on using hashes here.

File details

Details for the file CombinatorialProbability-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: CombinatorialProbability-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 18.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6

File hashes

Hashes for CombinatorialProbability-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 88fdbcf5eaf024eb0065dcc2912805fc72f3151b3dcabcffa9547dafc5e45105
MD5 86b6b67cb7e15b596b29b68095129fea
BLAKE2b-256 5145f7a22878617aa8ac1cd4cabd819645cd2883308fbab844cfdabef19761f7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page