Registry / ai-ml / sppl
library2.0.4pypypiunverified

SPPL is a probabilistic programming language for specifying and manipulating sum-product expressions. Version 2.0.4 targets Python >=3.8. The library enables concise modeling of discrete and continuous random variables with automatic inference.

pip install sppl
INSTALL
IMPORT
SIG · SPPL
S
sppl
ai-mlpythonv2.0.4
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

SPPLDistribution
from sppl.distributions import SPPLDistribution
from sppl import SPPLDistribution
SPPLDistribution is in the distributions submodule.
Model
from sppl import Model
Direct import from the top-level package.
Variable
from sppl import Variable
Direct import from the top-level package.

Creates a simple probabilistic model with a Bernoulli variable.

from sppl import Model, Variable from sppl.distributions import SPPLDistribution import os # Define a simple model: flip a fair coin model = Model() with model: x = Variable('x', SPPLDistribution.bernoulli(0.5)) # Check the model structure print(model)
Debug
Known issues
breakingIn version 2.0.0, the package structure changed: distributions are now in 'sppl.distributions' submodule, not directly under 'sppl'.
fix
Update imports: use 'from sppl.distributions import SPPLDistribution' instead of 'from sppl import SPPLDistribution'.
affects: <2.0.0
deprecatedThe function 'sppl.distributions.Distribution' is deprecated in favor of 'SPPLDistribution'.
fix
Replace 'Distribution' with 'SPPLDistribution' in your code.
affects: >=2.0.0
gotchaModel variables must be defined inside a 'with model:' block, otherwise they are not added to the model.
fix
Always use 'with model:' context manager when defining variables.
affects: all
Upgrade
Version history
2.0.4latest on PyPI · released Mar 22, 2022
Audit
Dependencies
numpyrequiredCore numerical operations
scipyrequiredStatistical distributions and optimization
sympyrequiredSymbolic mathematics for expression manipulation
Agent activity
8 hits · last 30 days
node
6
OpenAI (training)
1
Resources
sppl — pip install sppl · libregistry