distributions.to_json()

A distribution as a JSON document: the family and the parameters its

Usage

distributions.to_json(dist)

constructor takes, versioned, numbers bit for bit. from_json reads it back to an equal distribution of the same class.

A Custom cannot be saved: it is a Python function.

Parameters

dist: a distribution
Any distribution class, Sampled and Mixture included.

Returns

str

Raises

ValueError
For a Custom.

Examples

>>> from prospicio.distributions import Lognormal, from_json, to_json
>>> text = to_json(Lognormal(7.0, 0.5))
>>> from_json(text).mean() == Lognormal(7.0, 0.5).mean()

True