samplepy implements three sampling methods for univariate distributions. The package includes:
Importance sampling: samplepy.Importance
Rejection sampling: samplepy.Rejection
Metropolis-Hastings sampling: samplepy.MH
Examples:
from samplepy import Rejection
import matplotlib.pyplot as plt
import numpy as np
"""
Rejection sampling example from 2 different functions
"""
# define a unimodal function to sample under
f = lambda x: 2.0*np.exp(-2.0*x)
rej = Rejection(f, [0.01, 3.0]) # instantiate Rejection sampling with f and interval
sample = rej.sample(10000, 1) # create a sample of 10K points
x = np.arange(0.01, 3.0, (3.0-0.01)/10000)
fx = f(x)
figure, axis = plt.subplots()
axis.hist(sample, normed=1, bins=40)
axis2 = axis.twinx()
axis2.plot(x, fx, 'g', label="f(x)=2.0*exp(-2*x)")
plt.legend(loc=1)
plt.show()
More examples and package documentation can be found at <https://github.com/elena-sharova/samplepy/blob/master/README.rst>
Installation
pip install samplepy
Metadata
Release files for samplepy 1.0.11
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| samplepy-1.0.11.zip | 147.4 kB | Without provenance | Details for samplepy-1.0.11.zip |
Release files / samplepy-1.0.11.zip
| Download URL | samplepy-1.0.11.zip |
|---|---|
| Size | 147.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c739952aab59bd920f8d28e3aa81a2ce310465d114618d7fc3e2927dcdb8b63b
|
|
BLAKE2b-256 checksum How to use checksums |
77be186d0ba711a1cc4a46ec6171b1a3d63e6850edf7a61c3591b726cd27d9af
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for samplepy 1.0.11
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.