jupyterstan
jupyterstan is a package to help development of Stan models (using pystan)
in jupyter notebooks.
The package is heavily based on Arvinds-ds
stanmagic package, but provides an
interface that simply returns a pystan.Model object.
In addition, it bundles Arvinds-ds stan_code_helper package to improve
syntax highlighting for stan cells.
Features
- Stan language syntax highlighting in all cells beginning with
%%stan - Compile a stan model and save it as a pystan variable by running a
%%stancell - No longer worry about
model_code, reading in stan files, etc.
Installation
To install the library:
pip install jupyterstan
Usage
To use the magic in your notebook, you need to lead the extension:
%load_ext jupyterstan
To define a stan model inside a jupyter notebook, start a cell with the %%stan
magic. You can also provide a variable name, which is the variable name that
the pystan.Model object will be assigned to. For example:
%%stan paris_female_births
data {
int male;
int female;
}
parameters {
real<lower=0, upper=1> p;
}
model {
female ~ binomial(male + female, p);
}
When you run this cell, jupyterstan will create a pystan Model object, which will compile your model and allow
you to sample from it. To use your compiled model:
fit = paris_female_births.sampling(
data={'male': 251527, 'female': 241945},
iter=1000,
chains=4
)
Metadata
Release files for jupyterstan 0.2.0
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 |
|---|---|---|---|---|
| jupyterstan-0.2.0.tar.gz | 11.6 kB | Without provenance | Details for jupyterstan-0.2.0.tar.gz |
Release files / jupyterstan-0.2.0.tar.gz
| Download URL | jupyterstan-0.2.0.tar.gz |
|---|---|
| Size | 11.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bc234d0fb039a1e0bbdd7e4b8460c13be3cf141a931f6782160f6a62f2b77b43
|
|
BLAKE2b-256 checksum How to use checksums |
02bf21eff660bc918520bdbb91d898bc03eb6aef5acbb977ddfce994e8f8d420
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.1
|
Security for jupyterstan 0.2.0
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.