hypney.models package

Submodules

hypney.models.combinations module

class hypney.models.combinations.Mixture(models: Model, share=(), **kwargs)

Bases: AssociativeCombination

Model that is a mixture of other models; that is, events from all constituent models are observed simultaneously.

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

stack_axis0(xs)

Stack list of results from low-level methods along axis=0

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

var

model_names: Tuple[str]
models: Tuple[Model]
param_mapping: Dict[str, Tuple[str, str]]
class hypney.models.combinations.TensorProduct(models: Model, share=(), **kwargs)

Bases: AssociativeCombination

Model for which constituent models describe independent observables observed simultaneously for each event. (e.g. one model for energy, another for time) The first model will control the overall event rate.

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

stack_axis0(xs)

Stack list of results from low-level methods along axis=0

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

var

model_names: Tuple[str]
models: Tuple[Model]
param_mapping: Dict[str, Tuple[str, str]]
hypney.models.combinations.combine_param_specs(elements: Sequence[Model], names=None, share=())

Return param spec, mapping for new model made of other models Mapping is name -> (old name, new name)

Clashing unshared parameter names are renamed elementname_paramname For shared params, defaults and bounds are taken from the earliest model in the combination

hypney.models.combinations.mixture(*models, **kwargs)
hypney.models.combinations.tensor_product(*models, **kwargs)

hypney.models.cut module

class hypney.models.cut.CutModel(orig_model: ~hypney.model.Model = <class 'hypney.basics.NotChanged'>, cut=<class 'hypney.models.cut.NoCut'>, cut_type='halfopen', cut_data=False, fixed_cut_efficiency=None, *args, **kwargs)

Bases: WrappedModel

A model limiting observables to a rectangular region

Args (beyond those of Model):
  • orig_model: original model taking transformed parameters

  • cut: NoCut, or a tuple of (low, right) bounds for each observables

    None can be put in place for +-inf

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_cut(cut)

Return a valid cut, i.e. NoCut or tuple of (l, r) tuples for each observable.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

apply_cut

cdf

cut_efficiency

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

var

apply_cut(data=<class 'hypney.basics.NotChanged'>)
cut_efficiency(params: Optional[dict] = None, **kwargs) float
validate_cut(cut)

Return a valid cut, i.e. NoCut or tuple of (l, r) tuples for each observable.

class hypney.models.cut.NoCut

Bases: object

Instruction to not cut data

hypney.models.delta module

class hypney.models.delta.DiracDelta(*, name=<class 'hypney.basics.NotChanged'>, data=None, params=<class 'hypney.basics.NotChanged'>, param_specs=<class 'hypney.basics.NotChanged'>, observables=<class 'hypney.basics.NotChanged'>, quantiles=<class 'hypney.basics.NotChanged'>, validate_defaults=True, backend=None, **kwargs)

Bases: Model

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

var

param_specs: Tuple[Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()))

hypney.models.histogram module

class hypney.models.histogram.OneDHistogram(histogram, bin_edges=None, *args, **kwargs)

Bases: UnivariateDistribution

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
scipy_name
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

hypney.models.histogram.from_histogram(histogram, bin_edges=None, *args, **kwargs)
hypney.models.histogram.from_samples(samples, bin_edges=None, bin_count_multiplier=1, max_bins=1000, mass_bins=False)
hypney.models.histogram.guess_bin_edges(samples, bin_count_multiplier=1, mass_bins=False, max_bins=1000)

hypney.models.interpolation module

class hypney.models.interpolation.Interpolation(model_builder: callable, param_specs: ~typing.Union[tuple, dict], methods: ~typing.Tuple, progress=False, map=<class 'map'>, *args, **kwargs)

Bases: Model

Model which interpolates other models, depending on parameters.

You should only use one of pdf/cdf/ppf at a time; the others will be inconsistent!

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
interpolated_params
n_dim
param_names
quantiles
simulate_partially_efficient

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

var

anchor_models: Dict[tuple, Model]
data_methods_to_interpolate = ['pdf', 'logpdf', 'cdf', 'diff_rate']
property interpolated_params
other_methods_to_interpolate = ['rate', 'mean', 'std']

hypney.models.reparametrized module

class hypney.models.reparametrized.Reparametrized(*args, transform_params=<class 'hypney.basics.NotChanged'>, **kwargs)

Bases: WrappedModel

A model which transforms parameters, then feeds them to another model

Args (beyond those of Model):
  • orig_model: original model taking transformed parameters

  • transform_params: function mapping dict of params the new model takes

    to dict of params the old model takes

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

var

hypney.models.transform_data module

class hypney.models.transform_data.TransformedDataModel(*args, shift=<class 'hypney.basics.NotChanged'>, scale=<class 'hypney.basics.NotChanged'>, **kwargs)

Bases: WrappedModel

Model for data that has been shifted, then scaled.

Args (beyond those of Model):
  • orig_model: original model

  • shift: constant added to data

  • scale: constant by which shifted data is multiplied

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

var

scale = 1.0
shift = 0.0

hypney.models.univariate module

hypney.models.univariate_dist_list module

class hypney.models.univariate_dist_list.alpha(*args, **kwargs)

Bases: UnivariateDistribution

An alpha continuous random variable.

Notes

The probability density function for alpha ([1]_, [2]_) is:

\[f(x, a) = \frac{1}{x^2 \Phi(a) \sqrt{2\pi}} * \exp(-\frac{1}{2} (a-1/x)^2)\]

where \(\Phi\) is the normal CDF, \(x > 0\), and \(a > 0\).

alpha takes a as a shape parameter.

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='a', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'alpha'
class hypney.models.univariate_dist_list.anglit(*args, **kwargs)

Bases: UnivariateDistribution

An anglit continuous random variable.

Notes

The probability density function for anglit is:

\[f(x) = \sin(2x + \pi/2) = \cos(2x)\]

for \(-\pi/4 \le x \le \pi/4\).

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'anglit'
class hypney.models.univariate_dist_list.arcsine(*args, **kwargs)

Bases: UnivariateDistribution

An arcsine continuous random variable.

Notes

The probability density function for arcsine is:

\[f(x) = \frac{1}{\pi \sqrt{x (1-x)}}\]

for \(0 < x < 1\).

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'arcsine'
class hypney.models.univariate_dist_list.argus(*args, **kwargs)

Bases: UnivariateDistribution

Argus distribution

Notes

The probability density function for argus is:

\[f(x, \chi) = \frac{\chi^3}{\sqrt{2\pi} \Psi(\chi)} x \sqrt{1-x^2} \exp(-\chi^2 (1 - x^2)/2)\]

for \(0 < x < 1\) and \(\chi > 0\), where

\[\Psi(\chi) = \Phi(\chi) - \chi \phi(\chi) - 1/2\]

with \(\Phi\) and \(\phi\) being the CDF and PDF of a standard normal distribution, respectively.

argus takes \(\chi\) as shape a parameter.

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='chi', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'argus'
class hypney.models.univariate_dist_list.bernoulli(*args, **kwargs)

Bases: UnivariateDiscreteDistribution

A Bernoulli discrete random variable.

Notes

The probability mass function for bernoulli is:

\[\begin{split}f(k) = \begin{cases}1-p &\text{if } k = 0\\ p &\text{if } k = 1\end{cases}\end{split}\]

for \(k\) in \(\{0, 1\}\), \(0 \leq p \leq 1\)

bernoulli takes \(p\) as shape parameter, where \(p\) is the probability of a single success and \(1-p\) is the probability of a single failure.

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='p', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'bernoulli'
tfp_name: str = 'Bernoulli'
torch_name: str = 'Bernoulli'
class hypney.models.univariate_dist_list.beta(*args, **kwargs)

Bases: UnivariateDistribution

A beta continuous random variable.

Notes

The probability density function for beta is:

\[f(x, a, b) = \frac{\Gamma(a+b) x^{a-1} (1-x)^{b-1}} {\Gamma(a) \Gamma(b)}\]

for \(0 <= x <= 1\), \(a > 0\), \(b > 0\), where \(\Gamma\) is the gamma function (scipy.special.gamma).

beta takes \(a\) and \(b\) as shape parameters.

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='a', default=0, min=0, max=inf, share=False, anchors=()), Parameter(name='b', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'beta'
tfp_name: str = 'Beta'
torch_name: str = 'Beta'
class hypney.models.univariate_dist_list.betabinom(*args, **kwargs)

Bases: UnivariateDiscreteDistribution

A beta-binomial discrete random variable.

Notes

The beta-binomial distribution is a binomial distribution with a probability of success p that follows a beta distribution.

The probability mass function for betabinom is:

\[f(k) = \binom{n}{k} \frac{B(k + a, n - k + b)}{B(a, b)}\]

for k in {0, 1,..., n}, \(n \geq 0\), \(a > 0\), \(b > 0\), where \(B(a, b)\) is the beta function.

betabinom takes \(n\), \(a\), and \(b\) as shape parameters.

References

1

https://en.wikipedia.org/wiki/Beta-binomial_distribution

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='n', default=0, min=0, max=inf, share=False, anchors=()), Parameter(name='a', default=0, min=0, max=inf, share=False, anchors=()), Parameter(name='b', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'betabinom'
tfp_name: str = 'BetaBinomial'
class hypney.models.univariate_dist_list.betaprime(*args, **kwargs)

Bases: UnivariateDistribution

A beta prime continuous random variable.

Notes

The probability density function for betaprime is:

\[f(x, a, b) = \frac{x^{a-1} (1+x)^{-a-b}}{\beta(a, b)}\]

for \(x >= 0\), \(a > 0\), \(b > 0\), where \(\beta(a, b)\) is the beta function (see scipy.special.beta).

betaprime takes a and b as shape parameters.

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='a', default=0, min=0, max=inf, share=False, anchors=()), Parameter(name='b', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'betaprime'
class hypney.models.univariate_dist_list.binom(*args, **kwargs)

Bases: UnivariateDiscreteDistribution

A binomial discrete random variable.

Notes

The probability mass function for binom is:

\[f(k) = \binom{n}{k} p^k (1-p)^{n-k}\]

for k in {0, 1,..., n}, \(0 \leq p \leq 1\)

binom takes n and p as shape parameters, where \(p\) is the probability of a single success and \(1-p\) is the probability of a single failure.

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='n', default=0, min=0, max=inf, share=False, anchors=()), Parameter(name='p', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'binom'
tfp_name: str = 'Binomial'
torch_name: str = 'Binomial'
class hypney.models.univariate_dist_list.boltzmann(*args, **kwargs)

Bases: UnivariateDiscreteDistribution

A Boltzmann (Truncated Discrete Exponential) random variable.

Notes

The probability mass function for boltzmann is:

\[f(k) = (1-\exp(-\lambda)) \exp(-\lambda k) / (1-\exp(-\lambda N))\]

for \(k = 0,..., N-1\).

boltzmann takes \(\lambda > 0\) and \(N > 0\) as shape parameters.

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='lambda_', default=0, min=0, max=inf, share=False, anchors=()), Parameter(name='N', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'boltzmann'
class hypney.models.univariate_dist_list.bradford(*args, **kwargs)

Bases: UnivariateDistribution

A Bradford continuous random variable.

Notes

The probability density function for bradford is:

\[f(x, c) = \frac{c}{\log(1+c) (1+cx)}\]

for \(0 <= x <= 1\) and \(c > 0\).

bradford takes c as a shape parameter for \(c\).

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='c', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'bradford'
class hypney.models.univariate_dist_list.burr(*args, **kwargs)

Bases: UnivariateDistribution

A Burr (Type III) continuous random variable.

Notes

The probability density function for burr is:

\[f(x, c, d) = c d x^{-c - 1} / (1 + x^{-c})^{d + 1}\]

for \(x >= 0\) and \(c, d > 0\).

burr takes \(c\) and \(d\) as shape parameters.

This is the PDF corresponding to the third CDF given in Burr’s list; specifically, it is equation (11) in Burr’s paper [1]_. The distribution is also commonly referred to as the Dagum distribution [2]_. If the parameter \(c < 1\) then the mean of the distribution does not exist and if \(c < 2\) the variance does not exist [2]_. The PDF is finite at the left endpoint \(x = 0\) if \(c * d >= 1\).

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='c', default=0, min=0, max=inf, share=False, anchors=()), Parameter(name='d', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'burr'
class hypney.models.univariate_dist_list.burr12(*args, **kwargs)

Bases: UnivariateDistribution

A Burr (Type XII) continuous random variable.

Notes

The probability density function for burr is:

\[f(x, c, d) = c d x^{c-1} / (1 + x^c)^{d + 1}\]

for \(x >= 0\) and \(c, d > 0\).

burr12 takes c and d as shape parameters for \(c\) and \(d\).

This is the PDF corresponding to the twelfth CDF given in Burr’s list; specifically, it is equation (20) in Burr’s paper [1]_.

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='c', default=0, min=0, max=inf, share=False, anchors=()), Parameter(name='d', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'burr12'
class hypney.models.univariate_dist_list.cauchy(*args, **kwargs)

Bases: UnivariateDistribution

A Cauchy continuous random variable.

Notes

The probability density function for cauchy is

\[f(x) = \frac{1}{\pi (1 + x^2)}\]

for a real number \(x\).

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'cauchy'
tfp_name: str = 'Cauchy'
torch_name: str = 'Cauchy'
class hypney.models.univariate_dist_list.chi(*args, **kwargs)

Bases: UnivariateDistribution

A chi continuous random variable.

Notes

The probability density function for chi is:

\[f(x, k) = \frac{1}{2^{k/2-1} \Gamma \left( k/2 \right)} x^{k-1} \exp \left( -x^2/2 \right)\]

for \(x >= 0\) and \(k > 0\) (degrees of freedom, denoted df in the implementation). \(\Gamma\) is the gamma function (scipy.special.gamma).

Special cases of chi are:

  • chi(1, loc, scale) is equivalent to halfnorm

  • chi(2, 0, scale) is equivalent to rayleigh

  • chi(3, 0, scale) is equivalent to maxwell

chi takes df as a shape parameter.

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='df', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'chi'
tfp_name: str = 'Chi'
class hypney.models.univariate_dist_list.chi2(*args, **kwargs)

Bases: UnivariateDistribution

A chi-squared continuous random variable.

For the noncentral chi-square distribution, see ncx2.

Notes

The probability density function for chi2 is:

\[f(x, k) = \frac{1}{2^{k/2} \Gamma \left( k/2 \right)} x^{k/2-1} \exp \left( -x/2 \right)\]

for \(x > 0\) and \(k > 0\) (degrees of freedom, denoted df in the implementation).

chi2 takes df as a shape parameter.

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='df', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'chi2'
tfp_name: str = 'Chi2'
torch_name: str = 'Chi2'
class hypney.models.univariate_dist_list.cosine(*args, **kwargs)

Bases: UnivariateDistribution

A cosine continuous random variable.

Notes

The cosine distribution is an approximation to the normal distribution. The probability density function for cosine is:

\[f(x) = \frac{1}{2\pi} (1+\cos(x))\]

for \(-\pi \le x \le \pi\).

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'cosine'
class hypney.models.univariate_dist_list.crystalball(*args, **kwargs)

Bases: UnivariateDistribution

Crystalball distribution

Notes

The probability density function for crystalball is:

\[\begin{split}f(x, \beta, m) = \begin{cases} N \exp(-x^2 / 2), &\text{for } x > -\beta\\ N A (B - x)^{-m} &\text{for } x \le -\beta \end{cases}\end{split}\]

where \(A = (m / |\beta|)^n \exp(-\beta^2 / 2)\), \(B = m/|\beta| - |\beta|\) and \(N\) is a normalisation constant.

crystalball takes \(\beta > 0\) and \(m > 1\) as shape parameters. \(\beta\) defines the point where the pdf changes from a power-law to a Gaussian distribution. \(m\) is the power of the power-law tail.

References

1

“Crystal Ball Function”, https://en.wikipedia.org/wiki/Crystal_Ball_function

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='beta', default=0, min=0, max=inf, share=False, anchors=()), Parameter(name='m', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'crystalball'
class hypney.models.univariate_dist_list.dgamma(*args, **kwargs)

Bases: UnivariateDistribution

A double gamma continuous random variable.

Notes

The probability density function for dgamma is:

\[f(x, a) = \frac{1}{2\Gamma(a)} |x|^{a-1} \exp(-|x|)\]

for a real number \(x\) and \(a > 0\). \(\Gamma\) is the gamma function (scipy.special.gamma).

dgamma takes a as a shape parameter for \(a\).

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='a', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'dgamma'
class hypney.models.univariate_dist_list.dlaplace(*args, **kwargs)

Bases: UnivariateDiscreteDistribution

A Laplacian discrete random variable.

Notes

The probability mass function for dlaplace is:

\[f(k) = \tanh(a/2) \exp(-a |k|)\]

for integers \(k\) and \(a > 0\).

dlaplace takes \(a\) as shape parameter.

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='a', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'dlaplace'
class hypney.models.univariate_dist_list.dweibull(*args, **kwargs)

Bases: UnivariateDistribution

A double Weibull continuous random variable.

Notes

The probability density function for dweibull is given by

\[f(x, c) = c / 2 |x|^{c-1} \exp(-|x|^c)\]

for a real number \(x\) and \(c > 0\).

dweibull takes c as a shape parameter for \(c\).

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='c', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'dweibull'
class hypney.models.univariate_dist_list.erlang(*args, **kwargs)

Bases: UnivariateDistribution

An Erlang continuous random variable.

Notes

The Erlang distribution is a special case of the Gamma distribution, with the shape parameter a an integer. Note that this restriction is not enforced by erlang. It will, however, generate a warning the first time a non-integer value is used for the shape parameter.

Refer to gamma for examples.

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='a', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'erlang'
class hypney.models.univariate_dist_list.expon(*args, **kwargs)

Bases: UnivariateDistribution

An exponential continuous random variable.

Notes

The probability density function for expon is:

\[f(x) = \exp(-x)\]

for \(x \ge 0\).

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'expon'
class hypney.models.univariate_dist_list.exponnorm(*args, **kwargs)

Bases: UnivariateDistribution

An exponentially modified Normal continuous random variable.

Notes

The probability density function for exponnorm is:

\[f(x, K) = \frac{1}{2K} \exp\left(\frac{1}{2 K^2} - x / K \right) \text{erfc}\left(-\frac{x - 1/K}{\sqrt{2}}\right)\]

where \(x\) is a real number and \(K > 0\).

It can be thought of as the sum of a standard normal random variable and an independent exponentially distributed random variable with rate 1/K.

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='K', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'exponnorm'
class hypney.models.univariate_dist_list.exponpow(*args, **kwargs)

Bases: UnivariateDistribution

An exponential power continuous random variable.

Notes

The probability density function for exponpow is:

\[f(x, b) = b x^{b-1} \exp(1 + x^b - \exp(x^b))\]

for \(x \ge 0\), \(b > 0\). Note that this is a different distribution from the exponential power distribution that is also known under the names “generalized normal” or “generalized Gaussian”.

exponpow takes b as a shape parameter for \(b\).

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='b', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'exponpow'
class hypney.models.univariate_dist_list.exponweib(*args, **kwargs)

Bases: UnivariateDistribution

An exponentiated Weibull continuous random variable.

Notes

The probability density function for exponweib is:

\[f(x, a, c) = a c [1-\exp(-x^c)]^{a-1} \exp(-x^c) x^{c-1}\]

and its cumulative distribution function is:

\[F(x, a, c) = [1-\exp(-x^c)]^a\]

for \(x > 0\), \(a > 0\), \(c > 0\).

exponweib takes \(a\) and \(c\) as shape parameters:

  • \(a\) is the exponentiation parameter, with the special case \(a=1\) corresponding to the (non-exponentiated) Weibull distribution weibull_min.

  • \(c\) is the shape parameter of the non-exponentiated Weibull law.

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='a', default=0, min=0, max=inf, share=False, anchors=()), Parameter(name='c', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'exponweib'
class hypney.models.univariate_dist_list.f(*args, **kwargs)

Bases: UnivariateDistribution

An F continuous random variable.

For the noncentral F distribution, see ncf.

Notes

The probability density function for f is:

\[f(x, df_1, df_2) = \frac{df_2^{df_2/2} df_1^{df_1/2} x^{df_1 / 2-1}} {(df_2+df_1 x)^{(df_1+df_2)/2} B(df_1/2, df_2/2)}\]

for \(x > 0\).

f takes dfn and dfd as shape parameters.

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='dfn', default=0, min=0, max=inf, share=False, anchors=()), Parameter(name='dfd', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'f'
torch_name: str = 'FisherSnedecor'
class hypney.models.univariate_dist_list.fatiguelife(*args, **kwargs)

Bases: UnivariateDistribution

A fatigue-life (Birnbaum-Saunders) continuous random variable.

Notes

The probability density function for fatiguelife is:

\[f(x, c) = \frac{x+1}{2c\sqrt{2\pi x^3}} \exp(-\frac{(x-1)^2}{2x c^2})\]

for \(x >= 0\) and \(c > 0\).

fatiguelife takes c as a shape parameter for \(c\).

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='c', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'fatiguelife'
class hypney.models.univariate_dist_list.fisk(*args, **kwargs)

Bases: UnivariateDistribution

A Fisk continuous random variable.

The Fisk distribution is also known as the log-logistic distribution.

Notes

The probability density function for fisk is:

\[f(x, c) = c x^{-c-1} (1 + x^{-c})^{-2}\]

for \(x >= 0\) and \(c > 0\).

fisk takes c as a shape parameter for \(c\).

fisk is a special case of burr or burr12 with d=1.

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='c', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'fisk'
class hypney.models.univariate_dist_list.foldcauchy(*args, **kwargs)

Bases: UnivariateDistribution

A folded Cauchy continuous random variable.

Notes

The probability density function for foldcauchy is:

\[f(x, c) = \frac{1}{\pi (1+(x-c)^2)} + \frac{1}{\pi (1+(x+c)^2)}\]

for \(x \ge 0\).

foldcauchy takes c as a shape parameter for \(c\).

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='c', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'foldcauchy'
class hypney.models.univariate_dist_list.foldnorm(*args, **kwargs)

Bases: UnivariateDistribution

A folded normal continuous random variable.

Notes

The probability density function for foldnorm is:

\[f(x, c) = \sqrt{2/\pi} cosh(c x) \exp(-\frac{x^2+c^2}{2})\]

for \(c \ge 0\).

foldnorm takes c as a shape parameter for \(c\).

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='c', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'foldnorm'
class hypney.models.univariate_dist_list.gamma(*args, **kwargs)

Bases: UnivariateDistribution

A gamma continuous random variable.

Notes

The probability density function for gamma is:

\[f(x, a) = \frac{x^{a-1} e^{-x}}{\Gamma(a)}\]

for \(x \ge 0\), \(a > 0\). Here \(\Gamma(a)\) refers to the gamma function.

gamma takes a as a shape parameter for \(a\).

When \(a\) is an integer, gamma reduces to the Erlang distribution, and when \(a=1\) to the exponential distribution.

Gamma distributions are sometimes parameterized with two variables, with a probability density function of:

\[f(x, \alpha, \beta) = \frac{\beta^\alpha x^{\alpha - 1} e^{-\beta x }}{\Gamma(\alpha)}\]

Note that this parameterization is equivalent to the above, with scale = 1 / beta.

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='a', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'gamma'
tfp_name: str = 'Gamma'
torch_name: str = 'Gamma'
class hypney.models.univariate_dist_list.gausshyper(*args, **kwargs)

Bases: UnivariateDistribution

A Gauss hypergeometric continuous random variable.

Notes

The probability density function for gausshyper is:

\[f(x, a, b, c, z) = C x^{a-1} (1-x)^{b-1} (1+zx)^{-c}\]

for \(0 \le x \le 1\), \(a > 0\), \(b > 0\), \(z > -1\), and \(C = \frac{1}{B(a, b) F[2, 1](c, a; a+b; -z)}\). \(F[2, 1]\) is the Gauss hypergeometric function scipy.special.hyp2f1.

gausshyper takes \(a\), \(b\), \(c\) and \(z\) as shape parameters.

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='a', default=0, min=0, max=inf, share=False, anchors=()), Parameter(name='b', default=0, min=0, max=inf, share=False, anchors=()), Parameter(name='c', default=0, min=0, max=inf, share=False, anchors=()), Parameter(name='z', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'gausshyper'
class hypney.models.univariate_dist_list.genexpon(*args, **kwargs)

Bases: UnivariateDistribution

A generalized exponential continuous random variable.

Notes

The probability density function for genexpon is:

\[f(x, a, b, c) = (a + b (1 - \exp(-c x))) \exp(-a x - b x + \frac{b}{c} (1-\exp(-c x)))\]

for \(x \ge 0\), \(a, b, c > 0\).

genexpon takes \(a\), \(b\) and \(c\) as shape parameters.

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='a', default=0, min=0, max=inf, share=False, anchors=()), Parameter(name='b', default=0, min=0, max=inf, share=False, anchors=()), Parameter(name='c', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'genexpon'
class hypney.models.univariate_dist_list.genextreme(*args, **kwargs)

Bases: UnivariateDistribution

A generalized extreme value continuous random variable.

Notes

For \(c=0\), genextreme is equal to gumbel_r. The probability density function for genextreme is:

\[\begin{split}f(x, c) = \begin{cases} \exp(-\exp(-x)) \exp(-x) &\text{for } c = 0\\ \exp(-(1-c x)^{1/c}) (1-c x)^{1/c-1} &\text{for } x \le 1/c, c > 0 \end{cases}\end{split}\]

Note that several sources and software packages use the opposite convention for the sign of the shape parameter \(c\).

genextreme takes c as a shape parameter for \(c\).

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='c', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'genextreme'
class hypney.models.univariate_dist_list.gengamma(*args, **kwargs)

Bases: UnivariateDistribution

A generalized gamma continuous random variable.

Notes

The probability density function for gengamma is ([1]_):

\[f(x, a, c) = \frac{|c| x^{c a-1} \exp(-x^c)}{\Gamma(a)}\]

for \(x \ge 0\), \(a > 0\), and \(c \ne 0\). \(\Gamma\) is the gamma function (scipy.special.gamma).

gengamma takes \(a\) and \(c\) as shape parameters.

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='a', default=0, min=0, max=inf, share=False, anchors=()), Parameter(name='c', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'gengamma'
class hypney.models.univariate_dist_list.genhalflogistic(*args, **kwargs)

Bases: UnivariateDistribution

A generalized half-logistic continuous random variable.

Notes

The probability density function for genhalflogistic is:

\[f(x, c) = \frac{2 (1 - c x)^{1/(c-1)}}{[1 + (1 - c x)^{1/c}]^2}\]

for \(0 \le x \le 1/c\), and \(c > 0\).

genhalflogistic takes c as a shape parameter for \(c\).

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='c', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'genhalflogistic'
class hypney.models.univariate_dist_list.geninvgauss(*args, **kwargs)

Bases: UnivariateDistribution

A Generalized Inverse Gaussian continuous random variable.

Notes

The probability density function for geninvgauss is:

\[f(x, p, b) = x^{p-1} \exp(-b (x + 1/x) / 2) / (2 K_p(b))\]

where x > 0, and the parameters p, b satisfy b > 0 ([1]_). \(K_p\) is the modified Bessel function of second kind of order p (scipy.special.kv).

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='p', default=0, min=0, max=inf, share=False, anchors=()), Parameter(name='b', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'geninvgauss'
class hypney.models.univariate_dist_list.genlogistic(*args, **kwargs)

Bases: UnivariateDistribution

A generalized logistic continuous random variable.

Notes

The probability density function for genlogistic is:

\[f(x, c) = c \frac{\exp(-x)} {(1 + \exp(-x))^{c+1}}\]

for \(x >= 0\), \(c > 0\).

genlogistic takes c as a shape parameter for \(c\).

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='c', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'genlogistic'
class hypney.models.univariate_dist_list.gennorm(*args, **kwargs)

Bases: UnivariateDistribution

A generalized normal continuous random variable.

Notes

The probability density function for gennorm is [1]:

\[f(x, \beta) = \frac{\beta}{2 \Gamma(1/\beta)} \exp(-|x|^\beta)\]

\(\Gamma\) is the gamma function (scipy.special.gamma).

gennorm takes beta as a shape parameter for \(\beta\). For \(\beta = 1\), it is identical to a Laplace distribution. For \(\beta = 2\), it is identical to a normal distribution (with scale=1/sqrt(2)).

References

1

“Generalized normal distribution, Version 1”, https://en.wikipedia.org/wiki/Generalized_normal_distribution#Version_1

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='beta', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'gennorm'
class hypney.models.univariate_dist_list.genpareto(*args, **kwargs)

Bases: UnivariateDistribution

A generalized Pareto continuous random variable.

Notes

The probability density function for genpareto is:

\[f(x, c) = (1 + c x)^{-1 - 1/c}\]

defined for \(x \ge 0\) if \(c \ge 0\), and for \(0 \le x \le -1/c\) if \(c < 0\).

genpareto takes c as a shape parameter for \(c\).

For \(c=0\), genpareto reduces to the exponential distribution, expon:

\[f(x, 0) = \exp(-x)\]

For \(c=-1\), genpareto is uniform on [0, 1]:

\[f(x, -1) = 1\]
Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='c', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'genpareto'
class hypney.models.univariate_dist_list.geom(*args, **kwargs)

Bases: UnivariateDiscreteDistribution

A geometric discrete random variable.

Notes

The probability mass function for geom is:

\[f(k) = (1-p)^{k-1} p\]

for \(k \ge 1\), \(0 < p \leq 1\)

geom takes \(p\) as shape parameter, where \(p\) is the probability of a single success and \(1-p\) is the probability of a single failure.

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='p', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'geom'
tfp_name: str = 'Geometric'
torch_name: str = 'Geometric'
class hypney.models.univariate_dist_list.gilbrat(*args, **kwargs)

Bases: UnivariateDistribution

A Gilbrat continuous random variable.

Notes

The probability density function for gilbrat is:

\[f(x) = \frac{1}{x \sqrt{2\pi}} \exp(-\frac{1}{2} (\log(x))^2)\]

gilbrat is a special case of lognorm with s=1.

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'gilbrat'
class hypney.models.univariate_dist_list.gompertz(*args, **kwargs)

Bases: UnivariateDistribution

A Gompertz (or truncated Gumbel) continuous random variable.

Notes

The probability density function for gompertz is:

\[f(x, c) = c \exp(x) \exp(-c (e^x-1))\]

for \(x \ge 0\), \(c > 0\).

gompertz takes c as a shape parameter for \(c\).

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='c', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'gompertz'
class hypney.models.univariate_dist_list.gumbel_l(*args, **kwargs)

Bases: UnivariateDistribution

A left-skewed Gumbel continuous random variable.

Notes

The probability density function for gumbel_l is:

\[f(x) = \exp(x - e^x)\]

The Gumbel distribution is sometimes referred to as a type I Fisher-Tippett distribution. It is also related to the extreme value distribution, log-Weibull and Gompertz distributions.

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'gumbel_l'
class hypney.models.univariate_dist_list.gumbel_r(*args, **kwargs)

Bases: UnivariateDistribution

A right-skewed Gumbel continuous random variable.

Notes

The probability density function for gumbel_r is:

\[f(x) = \exp(-(x + e^{-x}))\]

The Gumbel distribution is sometimes referred to as a type I Fisher-Tippett distribution. It is also related to the extreme value distribution, log-Weibull and Gompertz distributions.

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'gumbel_r'
tfp_name: str = 'Gumbel'
torch_name: str = 'Gumbel'
class hypney.models.univariate_dist_list.halfcauchy(*args, **kwargs)

Bases: UnivariateDistribution

A Half-Cauchy continuous random variable.

Notes

The probability density function for halfcauchy is:

\[f(x) = \frac{2}{\pi (1 + x^2)}\]

for \(x \ge 0\).

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'halfcauchy'
tfp_name: str = 'HalfCauchy'
torch_name: str = 'HalfCauchy'
class hypney.models.univariate_dist_list.halfgennorm(*args, **kwargs)

Bases: UnivariateDistribution

The upper half of a generalized normal continuous random variable.

Notes

The probability density function for halfgennorm is:

\[f(x, \beta) = \frac{\beta}{\Gamma(1/\beta)} \exp(-|x|^\beta)\]

for \(x > 0\). \(\Gamma\) is the gamma function (scipy.special.gamma).

gennorm takes beta as a shape parameter for \(\beta\). For \(\beta = 1\), it is identical to an exponential distribution. For \(\beta = 2\), it is identical to a half normal distribution (with scale=1/sqrt(2)).

References

1

“Generalized normal distribution, Version 1”, https://en.wikipedia.org/wiki/Generalized_normal_distribution#Version_1

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='beta', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'halfgennorm'
class hypney.models.univariate_dist_list.halflogistic(*args, **kwargs)

Bases: UnivariateDistribution

A half-logistic continuous random variable.

Notes

The probability density function for halflogistic is:

\[f(x) = \frac{ 2 e^{-x} }{ (1+e^{-x})^2 } = \frac{1}{2} \text{sech}(x/2)^2\]

for \(x \ge 0\).

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'halflogistic'
class hypney.models.univariate_dist_list.halfnorm(*args, **kwargs)

Bases: UnivariateDistribution

A half-normal continuous random variable.

Notes

The probability density function for halfnorm is:

\[f(x) = \sqrt{2/\pi} \exp(-x^2 / 2)\]

for \(x >= 0\).

halfnorm is a special case of chi with df=1.

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'halfnorm'
tfp_name: str = 'HalfNormal'
torch_name: str = 'HalfNormal'
class hypney.models.univariate_dist_list.hypergeom(*args, **kwargs)

Bases: UnivariateDiscreteDistribution

A hypergeometric discrete random variable.

The hypergeometric distribution models drawing objects from a bin. M is the total number of objects, n is total number of Type I objects. The random variate represents the number of Type I objects in N drawn without replacement from the total population.

Notes

The symbols used to denote the shape parameters (M, n, and N) are not universally accepted. See the Examples for a clarification of the definitions used here.

The probability mass function is defined as,

\[p(k, M, n, N) = \frac{\binom{n}{k} \binom{M - n}{N - k}} {\binom{M}{N}}\]

for \(k \in [\max(0, N - M + n), \min(n, N)]\), where the binomial coefficients are defined as,

\[\binom{n}{k} \equiv \frac{n!}{k! (n - k)!}.\]
Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='M', default=0, min=0, max=inf, share=False, anchors=()), Parameter(name='n', default=0, min=0, max=inf, share=False, anchors=()), Parameter(name='N', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'hypergeom'
class hypney.models.univariate_dist_list.hypsecant(*args, **kwargs)

Bases: UnivariateDistribution

A hyperbolic secant continuous random variable.

Notes

The probability density function for hypsecant is:

\[f(x) = \frac{1}{\pi} \text{sech}(x)\]

for a real number \(x\).

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'hypsecant'
class hypney.models.univariate_dist_list.invgamma(*args, **kwargs)

Bases: UnivariateDistribution

An inverted gamma continuous random variable.

Notes

The probability density function for invgamma is:

\[f(x, a) = \frac{x^{-a-1}}{\Gamma(a)} \exp(-\frac{1}{x})\]

for \(x >= 0\), \(a > 0\). \(\Gamma\) is the gamma function (scipy.special.gamma).

invgamma takes a as a shape parameter for \(a\).

invgamma is a special case of gengamma with c=-1.

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='a', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'invgamma'
tfp_name: str = 'InverseGamma'
class hypney.models.univariate_dist_list.invgauss(*args, **kwargs)

Bases: UnivariateDistribution

An inverse Gaussian continuous random variable.

Notes

The probability density function for invgauss is:

\[f(x, \mu) = \frac{1}{\sqrt{2 \pi x^3}} \exp(-\frac{(x-\mu)^2}{2 x \mu^2})\]

for \(x >= 0\) and \(\mu > 0\).

invgauss takes mu as a shape parameter for \(\mu\).

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='mu', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'invgauss'
class hypney.models.univariate_dist_list.invweibull(*args, **kwargs)

Bases: UnivariateDistribution

An inverted Weibull continuous random variable.

This distribution is also known as the Fréchet distribution or the type II extreme value distribution.

Notes

The probability density function for invweibull is:

\[f(x, c) = c x^{-c-1} \exp(-x^{-c})\]

for \(x > 0\), \(c > 0\).

invweibull takes c as a shape parameter for \(c\).

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='c', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'invweibull'
class hypney.models.univariate_dist_list.johnsonsb(*args, **kwargs)

Bases: UnivariateDistribution

A Johnson SB continuous random variable.

Notes

The probability density function for johnsonsb is:

\[f(x, a, b) = \frac{b}{x(1-x)} \phi(a + b \log \frac{x}{1-x} )\]

for \(0 <= x < =1\) and \(a, b > 0\), and \(\phi\) is the normal pdf.

johnsonsb takes \(a\) and \(b\) as shape parameters.

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='a', default=0, min=0, max=inf, share=False, anchors=()), Parameter(name='b', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'johnsonsb'
class hypney.models.univariate_dist_list.johnsonsu(*args, **kwargs)

Bases: UnivariateDistribution

A Johnson SU continuous random variable.

Notes

The probability density function for johnsonsu is:

\[f(x, a, b) = \frac{b}{\sqrt{x^2 + 1}} \phi(a + b \log(x + \sqrt{x^2 + 1}))\]

for all \(x, a, b > 0\), and \(\phi\) is the normal pdf.

johnsonsu takes \(a\) and \(b\) as shape parameters.

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='a', default=0, min=0, max=inf, share=False, anchors=()), Parameter(name='b', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'johnsonsu'
class hypney.models.univariate_dist_list.kappa3(*args, **kwargs)

Bases: UnivariateDistribution

Kappa 3 parameter distribution.

Notes

The probability density function for kappa3 is:

\[f(x, a) = a (a + x^a)^{-(a + 1)/a}\]

for \(x > 0\) and \(a > 0\).

kappa3 takes a as a shape parameter for \(a\).

References

P.W. Mielke and E.S. Johnson, “Three-Parameter Kappa Distribution Maximum Likelihood and Likelihood Ratio Tests”, Methods in Weather Research, 701-707, (September, 1973), :doi:`10.1175/1520-0493(1973)101<0701:TKDMLE>2.3.CO;2`

B. Kumphon, “Maximum Entropy and Maximum Likelihood Estimation for the Three-Parameter Kappa Distribution”, Open Journal of Statistics, vol 2, 415-419 (2012), :doi:`10.4236/ojs.2012.24050`

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='a', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'kappa3'
class hypney.models.univariate_dist_list.kappa4(*args, **kwargs)

Bases: UnivariateDistribution

Kappa 4 parameter distribution.

Notes

The probability density function for kappa4 is:

\[f(x, h, k) = (1 - k x)^{1/k - 1} (1 - h (1 - k x)^{1/k})^{1/h-1}\]

if \(h\) and \(k\) are not equal to 0.

If \(h\) or \(k\) are zero then the pdf can be simplified:

h = 0 and k != 0:

kappa4.pdf(x, h, k) = (1.0 - k*x)**(1.0/k - 1.0)*
                      exp(-(1.0 - k*x)**(1.0/k))

h != 0 and k = 0:

kappa4.pdf(x, h, k) = exp(-x)*(1.0 - h*exp(-x))**(1.0/h - 1.0)

h = 0 and k = 0:

kappa4.pdf(x, h, k) = exp(-x)*exp(-exp(-x))

kappa4 takes \(h\) and \(k\) as shape parameters.

The kappa4 distribution returns other distributions when certain \(h\) and \(k\) values are used.

h

k=0.0

k=1.0

-inf<=k<=inf

-1.0

Logistic

logistic(x)

Generalized Logistic(1)

0.0

Gumbel

gumbel_r(x)

Reverse Exponential(2)

Generalized Extreme Value

genextreme(x, k)

1.0

Exponential

expon(x)

Uniform

uniform(x)

Generalized Pareto

genpareto(x, -k)

  1. There are at least five generalized logistic distributions. Four are described here: https://en.wikipedia.org/wiki/Generalized_logistic_distribution The “fifth” one is the one kappa4 should match which currently isn’t implemented in scipy: https://en.wikipedia.org/wiki/Talk:Generalized_logistic_distribution https://www.mathwave.com/help/easyfit/html/analyses/distributions/gen_logistic.html

  2. This distribution is currently not in scipy.

References

J.C. Finney, “Optimization of a Skewed Logistic Distribution With Respect to the Kolmogorov-Smirnov Test”, A Dissertation Submitted to the Graduate Faculty of the Louisiana State University and Agricultural and Mechanical College, (August, 2004), https://digitalcommons.lsu.edu/gradschool_dissertations/3672

J.R.M. Hosking, “The four-parameter kappa distribution”. IBM J. Res. Develop. 38 (3), 25 1-258 (1994).

B. Kumphon, A. Kaew-Man, P. Seenoi, “A Rainfall Distribution for the Lampao Site in the Chi River Basin, Thailand”, Journal of Water Resource and Protection, vol. 4, 866-869, (2012). :doi:`10.4236/jwarp.2012.410101`

C. Winchester, “On Estimation of the Four-Parameter Kappa Distribution”, A Thesis Submitted to Dalhousie University, Halifax, Nova Scotia, (March 2000). http://www.nlc-bnc.ca/obj/s4/f2/dsk2/ftp01/MQ57336.pdf

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='h', default=0, min=0, max=inf, share=False, anchors=()), Parameter(name='k', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'kappa4'
class hypney.models.univariate_dist_list.ksone(*args, **kwargs)

Bases: UnivariateDistribution

Kolmogorov-Smirnov one-sided test statistic distribution.

This is the distribution of the one-sided Kolmogorov-Smirnov (KS) statistics \(D_n^+\) and \(D_n^-\) for a finite sample size n (the shape parameter).

Notes

\(D_n^+\) and \(D_n^-\) are given by

\[\begin{split}D_n^+ &= \text{sup}_x (F_n(x) - F(x)),\\ D_n^- &= \text{sup}_x (F(x) - F_n(x)),\\\end{split}\]

where \(F\) is a continuous CDF and \(F_n\) is an empirical CDF. ksone describes the distribution under the null hypothesis of the KS test that the empirical CDF corresponds to \(n\) i.i.d. random variates with CDF \(F\).

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='n', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'ksone'
class hypney.models.univariate_dist_list.kstwo(*args, **kwargs)

Bases: UnivariateDistribution

Kolmogorov-Smirnov two-sided test statistic distribution.

This is the distribution of the two-sided Kolmogorov-Smirnov (KS) statistic \(D_n\) for a finite sample size n (the shape parameter).

Notes

\(D_n\) is given by

\[D_n &= \text{sup}_x |F_n(x) - F(x)|\]

where \(F\) is a (continuous) CDF and \(F_n\) is an empirical CDF. kstwo describes the distribution under the null hypothesis of the KS test that the empirical CDF corresponds to \(n\) i.i.d. random variates with CDF \(F\).

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='n', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'kstwo'
class hypney.models.univariate_dist_list.kstwobign(*args, **kwargs)

Bases: UnivariateDistribution

Limiting distribution of scaled Kolmogorov-Smirnov two-sided test statistic.

This is the asymptotic distribution of the two-sided Kolmogorov-Smirnov statistic \(\sqrt{n} D_n\) that measures the maximum absolute distance of the theoretical (continuous) CDF from the empirical CDF. (see kstest).

Notes

\(\sqrt{n} D_n\) is given by

\[D_n = \text{sup}_x |F_n(x) - F(x)|\]

where \(F\) is a continuous CDF and \(F_n\) is an empirical CDF. kstwobign describes the asymptotic distribution (i.e. the limit of \(\sqrt{n} D_n\)) under the null hypothesis of the KS test that the empirical CDF corresponds to i.i.d. random variates with CDF \(F\).

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'kstwobign'
class hypney.models.univariate_dist_list.laplace(*args, **kwargs)

Bases: UnivariateDistribution

A Laplace continuous random variable.

Notes

The probability density function for laplace is

\[f(x) = \frac{1}{2} \exp(-|x|)\]

for a real number \(x\).

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'laplace'
tfp_name: str = 'Laplace'
torch_name: str = 'Laplace'
class hypney.models.univariate_dist_list.laplace_asymmetric(*args, **kwargs)

Bases: UnivariateDistribution

An asymmetric Laplace continuous random variable.

Notes

The probability density function for laplace_asymmetric is

\[\begin{split}f(x, \kappa) &= \frac{1}{\kappa+\kappa^{-1}}\exp(-x\kappa),\quad x\ge0\\ &= \frac{1}{\kappa+\kappa^{-1}}\exp(x/\kappa),\quad x<0\\\end{split}\]

for \(-\infty < x < \infty\), \(\kappa > 0\).

laplace_asymmetric takes kappa as a shape parameter for \(\kappa\). For \(\kappa = 1\), it is identical to a Laplace distribution.

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='kappa', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'laplace_asymmetric'
class hypney.models.univariate_dist_list.levy(*args, **kwargs)

Bases: UnivariateDistribution

A Levy continuous random variable.

Notes

The probability density function for levy is:

\[f(x) = \frac{1}{\sqrt{2\pi x^3}} \exp\left(-\frac{1}{2x}\right)\]

for \(x >= 0\).

This is the same as the Levy-stable distribution with \(a=1/2\) and \(b=1\).

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'levy'
class hypney.models.univariate_dist_list.levy_l(*args, **kwargs)

Bases: UnivariateDistribution

A left-skewed Levy continuous random variable.

Notes

The probability density function for levy_l is:

\[f(x) = \frac{1}{|x| \sqrt{2\pi |x|}} \exp{ \left(-\frac{1}{2|x|} \right)}\]

for \(x <= 0\).

This is the same as the Levy-stable distribution with \(a=1/2\) and \(b=-1\).

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'levy_l'
class hypney.models.univariate_dist_list.levy_stable(*args, **kwargs)

Bases: UnivariateDistribution

A Levy-stable continuous random variable.

Notes

The distribution for levy_stable has characteristic function:

\[\varphi(t, \alpha, \beta, c, \mu) = e^{it\mu -|ct|^{\alpha}(1-i\beta \operatorname{sign}(t)\Phi(\alpha, t))}\]

where:

\[\begin{split}\Phi = \begin{cases} \tan \left({\frac {\pi \alpha }{2}}\right)&\alpha \neq 1\\ -{\frac {2}{\pi }}\log |t|&\alpha =1 \end{cases}\end{split}\]

The probability density function for levy_stable is:

\[f(x) = \frac{1}{2\pi}\int_{-\infty}^\infty \varphi(t)e^{-ixt}\,dt\]

where \(-\infty < t < \infty\). This integral does not have a known closed form.

For evaluation of pdf we use either Zolotarev \(S_0\) parameterization with integration, direct integration of standard parameterization of characteristic function or FFT of characteristic function. If set to other than None and if number of points is greater than levy_stable.pdf_fft_min_points_threshold (defaults to None) we use FFT otherwise we use one of the other methods.

The default method is ‘best’ which uses Zolotarev’s method if alpha = 1 and integration of characteristic function otherwise. The default method can be changed by setting levy_stable.pdf_default_method to either ‘zolotarev’, ‘quadrature’ or ‘best’.

To increase accuracy of FFT calculation one can specify levy_stable.pdf_fft_grid_spacing (defaults to 0.001) and pdf_fft_n_points_two_power (defaults to a value that covers the input range * 4). Setting pdf_fft_n_points_two_power to 16 should be sufficiently accurate in most cases at the expense of CPU time.

For evaluation of cdf we use Zolatarev \(S_0\) parameterization with integration or integral of the pdf FFT interpolated spline. The settings affecting FFT calculation are the same as for pdf calculation. Setting the threshold to None (default) will disable FFT. For cdf calculations the Zolatarev method is superior in accuracy, so FFT is disabled by default.

Fitting estimate uses quantile estimation method in [MC]. MLE estimation of parameters in fit method uses this quantile estimate initially. Note that MLE doesn’t always converge if using FFT for pdf calculations; so it’s best that pdf_fft_min_points_threshold is left unset.

Warning

For pdf calculations implementation of Zolatarev is unstable for values where alpha = 1 and beta != 0. In this case the quadrature method is recommended. FFT calculation is also considered experimental.

For cdf calculations FFT calculation is considered experimental. Use Zolatarev’s method instead (default).

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='alpha', default=0, min=0, max=inf, share=False, anchors=()), Parameter(name='beta', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'levy_stable'
class hypney.models.univariate_dist_list.loggamma(*args, **kwargs)

Bases: UnivariateDistribution

A log gamma continuous random variable.

Notes

The probability density function for loggamma is:

\[f(x, c) = \frac{\exp(c x - \exp(x))} {\Gamma(c)}\]

for all \(x, c > 0\). Here, \(\Gamma\) is the gamma function (scipy.special.gamma).

loggamma takes c as a shape parameter for \(c\).

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='c', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'loggamma'
class hypney.models.univariate_dist_list.logistic(*args, **kwargs)

Bases: UnivariateDistribution

A logistic (or Sech-squared) continuous random variable.

Notes

The probability density function for logistic is:

\[f(x) = \frac{\exp(-x)} {(1+\exp(-x))^2}\]

logistic is a special case of genlogistic with c=1.

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'logistic'
tfp_name: str = 'Logistic'
class hypney.models.univariate_dist_list.loglaplace(*args, **kwargs)

Bases: UnivariateDistribution

A log-Laplace continuous random variable.

Notes

The probability density function for loglaplace is:

\[\begin{split}f(x, c) = \begin{cases}\frac{c}{2} x^{ c-1} &\text{for } 0 < x < 1\\ \frac{c}{2} x^{-c-1} &\text{for } x \ge 1 \end{cases}\end{split}\]

for \(c > 0\).

loglaplace takes c as a shape parameter for \(c\).

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='c', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'loglaplace'
class hypney.models.univariate_dist_list.lognorm(*args, **kwargs)

Bases: UnivariateDistribution

A lognormal continuous random variable.

Notes

The probability density function for lognorm is:

\[f(x, s) = \frac{1}{s x \sqrt{2\pi}} \exp\left(-\frac{\log^2(x)}{2s^2}\right)\]

for \(x > 0\), \(s > 0\).

lognorm takes s as a shape parameter for \(s\).

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='s', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'lognorm'
tfp_name: str = 'LogNormal'
torch_name: str = 'LogNormal'
class hypney.models.univariate_dist_list.logser(*args, **kwargs)

Bases: UnivariateDiscreteDistribution

A Logarithmic (Log-Series, Series) discrete random variable.

Notes

The probability mass function for logser is:

\[f(k) = - \frac{p^k}{k \log(1-p)}\]

for \(k \ge 1\), \(0 < p < 1\)

logser takes \(p\) as shape parameter, where \(p\) is the probability of a single success and \(1-p\) is the probability of a single failure.

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='p', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'logser'
class hypney.models.univariate_dist_list.loguniform(*args, **kwargs)

Bases: UnivariateDistribution

A loguniform or reciprocal continuous random variable.

Notes

The probability density function for this class is:

\[f(x, a, b) = \frac{1}{x \log(b/a)}\]

for \(a \le x \le b\), \(b > a > 0\). This class takes \(a\) and \(b\) as shape parameters.

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='a', default=0, min=0, max=inf, share=False, anchors=()), Parameter(name='b', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'loguniform'
class hypney.models.univariate_dist_list.lomax(*args, **kwargs)

Bases: UnivariateDistribution

A Lomax (Pareto of the second kind) continuous random variable.

Notes

The probability density function for lomax is:

\[f(x, c) = \frac{c}{(1+x)^{c+1}}\]

for \(x \ge 0\), \(c > 0\).

lomax takes c as a shape parameter for \(c\).

lomax is a special case of pareto with loc=-1.0.

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='c', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'lomax'
class hypney.models.univariate_dist_list.maxwell(*args, **kwargs)

Bases: UnivariateDistribution

A Maxwell continuous random variable.

Notes

A special case of a chi distribution, with df=3, loc=0.0, and given scale = a, where a is the parameter used in the Mathworld description [1]_.

The probability density function for maxwell is:

\[f(x) = \sqrt{2/\pi}x^2 \exp(-x^2/2)\]

for \(x >= 0\).

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'maxwell'
class hypney.models.univariate_dist_list.mielke(*args, **kwargs)

Bases: UnivariateDistribution

A Mielke Beta-Kappa / Dagum continuous random variable.

Notes

The probability density function for mielke is:

\[f(x, k, s) = \frac{k x^{k-1}}{(1+x^s)^{1+k/s}}\]

for \(x > 0\) and \(k, s > 0\). The distribution is sometimes called Dagum distribution ([2]_). It was already defined in [3]_, called a Burr Type III distribution (burr with parameters c=s and d=k/s).

mielke takes k and s as shape parameters.

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='k', default=0, min=0, max=inf, share=False, anchors=()), Parameter(name='s', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'mielke'
class hypney.models.univariate_dist_list.moyal(*args, **kwargs)

Bases: UnivariateDistribution

A Moyal continuous random variable.

Notes

The probability density function for moyal is:

\[f(x) = \exp(-(x + \exp(-x))/2) / \sqrt{2\pi}\]

for a real number \(x\).

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'moyal'
tfp_name: str = 'Moyal'
class hypney.models.univariate_dist_list.nakagami(*args, **kwargs)

Bases: UnivariateDistribution

A Nakagami continuous random variable.

Notes

The probability density function for nakagami is:

\[f(x, \nu) = \frac{2 \nu^\nu}{\Gamma(\nu)} x^{2\nu-1} \exp(-\nu x^2)\]

for \(x >= 0\), \(\nu > 0\).

nakagami takes nu as a shape parameter for \(\nu\).

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='nu', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'nakagami'
class hypney.models.univariate_dist_list.nbinom(*args, **kwargs)

Bases: UnivariateDiscreteDistribution

A negative binomial discrete random variable.

Notes

Negative binomial distribution describes a sequence of i.i.d. Bernoulli trials, repeated until a predefined, non-random number of successes occurs.

The probability mass function of the number of failures for nbinom is:

\[f(k) = \binom{k+n-1}{n-1} p^n (1-p)^k\]

for \(k \ge 0\), \(0 < p \leq 1\)

nbinom takes \(n\) and \(p\) as shape parameters where n is the number of successes, \(p\) is the probability of a single success, and \(1-p\) is the probability of a single failure.

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='n', default=0, min=0, max=inf, share=False, anchors=()), Parameter(name='p', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'nbinom'
tfp_name: str = 'NegativeBinomial'
torch_name: str = 'NegativeBinomial'
class hypney.models.univariate_dist_list.ncf(*args, **kwargs)

Bases: UnivariateDistribution

A non-central F distribution continuous random variable.

Notes

The probability density function for ncf is:

\[\begin{split}f(x, n_1, n_2, \lambda) = \exp\left(\frac{\lambda}{2} + \lambda n_1 \frac{x}{2(n_1 x + n_2)} \right) n_1^{n_1/2} n_2^{n_2/2} x^{n_1/2 - 1} \\ (n_2 + n_1 x)^{-(n_1 + n_2)/2} \gamma(n_1/2) \gamma(1 + n_2/2) \\ \frac{L^{\frac{n_1}{2}-1}_{n_2/2} \left(-\lambda n_1 \frac{x}{2(n_1 x + n_2)}\right)} {B(n_1/2, n_2/2) \gamma\left(\frac{n_1 + n_2}{2}\right)}\end{split}\]

for \(n_1, n_2 > 0\), \(\lambda\geq 0\). Here \(n_1\) is the degrees of freedom in the numerator, \(n_2\) the degrees of freedom in the denominator, \(\lambda\) the non-centrality parameter, \(\gamma\) is the logarithm of the Gamma function, \(L_n^k\) is a generalized Laguerre polynomial and \(B\) is the beta function.

ncf takes df1, df2 and nc as shape parameters. If nc=0, the distribution becomes equivalent to the Fisher distribution.

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='dfn', default=0, min=0, max=inf, share=False, anchors=()), Parameter(name='dfd', default=0, min=0, max=inf, share=False, anchors=()), Parameter(name='nc', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'ncf'
class hypney.models.univariate_dist_list.nct(*args, **kwargs)

Bases: UnivariateDistribution

A non-central Student’s t continuous random variable.

Notes

If \(Y\) is a standard normal random variable and \(V\) is an independent chi-square random variable (chi2) with \(k\) degrees of freedom, then

\[X = \frac{Y + c}{\sqrt{V/k}}\]

has a non-central Student’s t distribution on the real line. The degrees of freedom parameter \(k\) (denoted df in the implementation) satisfies \(k > 0\) and the noncentrality parameter \(c\) (denoted nc in the implementation) is a real number.

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='df', default=0, min=0, max=inf, share=False, anchors=()), Parameter(name='nc', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'nct'
class hypney.models.univariate_dist_list.ncx2(*args, **kwargs)

Bases: UnivariateDistribution

A non-central chi-squared continuous random variable.

Notes

The probability density function for ncx2 is:

\[f(x, k, \lambda) = \frac{1}{2} \exp(-(\lambda+x)/2) (x/\lambda)^{(k-2)/4} I_{(k-2)/2}(\sqrt{\lambda x})\]

for \(x >= 0\) and \(k, \lambda > 0\). \(k\) specifies the degrees of freedom (denoted df in the implementation) and \(\lambda\) is the non-centrality parameter (denoted nc in the implementation). \(I_\nu\) denotes the modified Bessel function of first order of degree \(\nu\) (scipy.special.iv).

ncx2 takes df and nc as shape parameters.

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='df', default=0, min=0, max=inf, share=False, anchors=()), Parameter(name='nc', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'ncx2'
class hypney.models.univariate_dist_list.nhypergeom(*args, **kwargs)

Bases: UnivariateDiscreteDistribution

A negative hypergeometric discrete random variable.

Consider a box containing \(M\) balls:, \(n\) red and \(M-n\) blue. We randomly sample balls from the box, one at a time and without replacement, until we have picked \(r\) blue balls. nhypergeom is the distribution of the number of red balls \(k\) we have picked.

Notes

The symbols used to denote the shape parameters (M, n, and r) are not universally accepted. See the Examples for a clarification of the definitions used here.

The probability mass function is defined as,

\[f(k; M, n, r) = \frac{{{k+r-1}\choose{k}}{{M-r-k}\choose{n-k}}} {{M \choose n}}\]

for \(k \in [0, n]\), \(n \in [0, M]\), \(r \in [0, M-n]\), and the binomial coefficient is:

\[\binom{n}{k} \equiv \frac{n!}{k! (n - k)!}.\]

It is equivalent to observing \(k\) successes in \(k+r-1\) samples with \(k+r\)’th sample being a failure. The former can be modelled as a hypergeometric distribution. The probability of the latter is simply the number of failures remaining \(M-n-(r-1)\) divided by the size of the remaining population \(M-(k+r-1)\). This relationship can be shown as:

\[NHG(k;M,n,r) = HG(k;M,n,k+r-1)\frac{(M-n-(r-1))}{(M-(k+r-1))}\]

where \(NHG\) is probability mass function (PMF) of the negative hypergeometric distribution and \(HG\) is the PMF of the hypergeometric distribution.

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='M', default=0, min=0, max=inf, share=False, anchors=()), Parameter(name='n', default=0, min=0, max=inf, share=False, anchors=()), Parameter(name='r', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'nhypergeom'
class hypney.models.univariate_dist_list.norm(*args, **kwargs)

Bases: UnivariateDistribution

A normal continuous random variable.

The location (loc) keyword specifies the mean. The scale (scale) keyword specifies the standard deviation.

Notes

The probability density function for norm is:

\[f(x) = \frac{\exp(-x^2/2)}{\sqrt{2\pi}}\]

for a real number \(x\).

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'norm'
tfp_name: str = 'Normal'
torch_name: str = 'Normal'
class hypney.models.univariate_dist_list.norminvgauss(*args, **kwargs)

Bases: UnivariateDistribution

A Normal Inverse Gaussian continuous random variable.

Notes

The probability density function for norminvgauss is:

\[f(x, a, b) = \frac{a \, K_1(a \sqrt{1 + x^2})}{\pi \sqrt{1 + x^2}} \, \exp(\sqrt{a^2 - b^2} + b x)\]

where \(x\) is a real number, the parameter \(a\) is the tail heaviness and \(b\) is the asymmetry parameter satisfying \(a > 0\) and \(|b| <= a\). \(K_1\) is the modified Bessel function of second kind (scipy.special.k1).

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='a', default=0, min=0, max=inf, share=False, anchors=()), Parameter(name='b', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'norminvgauss'
class hypney.models.univariate_dist_list.pareto(*args, **kwargs)

Bases: UnivariateDistribution

A Pareto continuous random variable.

Notes

The probability density function for pareto is:

\[f(x, b) = \frac{b}{x^{b+1}}\]

for \(x \ge 1\), \(b > 0\).

pareto takes b as a shape parameter for \(b\).

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='b', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'pareto'
tfp_name: str = 'Pareto'
torch_name: str = 'Pareto'
class hypney.models.univariate_dist_list.pearson3(*args, **kwargs)

Bases: UnivariateDistribution

A pearson type III continuous random variable.

Notes

The probability density function for pearson3 is:

\[f(x, \kappa) = \frac{|\beta|}{\Gamma(\alpha)} (\beta (x - \zeta))^{\alpha - 1} \exp(-\beta (x - \zeta))\]

where:

\[ \begin{align}\begin{aligned}\beta = \frac{2}{\kappa}\\\alpha = \beta^2 = \frac{4}{\kappa^2}\\\zeta = -\frac{\alpha}{\beta} = -\beta\end{aligned}\end{align} \]

\(\Gamma\) is the gamma function (scipy.special.gamma). Pass the skew \(\kappa\) into pearson3 as the shape parameter skew.

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='skew', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'pearson3'
class hypney.models.univariate_dist_list.planck(*args, **kwargs)

Bases: UnivariateDiscreteDistribution

A Planck discrete exponential random variable.

Notes

The probability mass function for planck is:

\[f(k) = (1-\exp(-\lambda)) \exp(-\lambda k)\]

for \(k \ge 0\) and \(\lambda > 0\).

planck takes \(\lambda\) as shape parameter. The Planck distribution can be written as a geometric distribution (geom) with \(p = 1 - \exp(-\lambda)\) shifted by loc = -1.

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='lambda_', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'planck'
class hypney.models.univariate_dist_list.poisson(*args, **kwargs)

Bases: UnivariateDiscreteDistribution

A Poisson discrete random variable.

Notes

The probability mass function for poisson is:

\[f(k) = \exp(-\mu) \frac{\mu^k}{k!}\]

for \(k \ge 0\).

poisson takes \(\mu\) as shape parameter. When mu = 0 then at quantile k = 0, pmf method returns 1.0.

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='mu', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'poisson'
tfp_name: str = 'Poisson'
torch_name: str = 'Poisson'
class hypney.models.univariate_dist_list.powerlaw(*args, **kwargs)

Bases: UnivariateDistribution

A power-function continuous random variable.

Notes

The probability density function for powerlaw is:

\[f(x, a) = a x^{a-1}\]

for \(0 \le x \le 1\), \(a > 0\).

powerlaw takes a as a shape parameter for \(a\).

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='a', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'powerlaw'
class hypney.models.univariate_dist_list.powerlognorm(*args, **kwargs)

Bases: UnivariateDistribution

A power log-normal continuous random variable.

Notes

The probability density function for powerlognorm is:

\[f(x, c, s) = \frac{c}{x s} \phi(\log(x)/s) (\Phi(-\log(x)/s))^{c-1}\]

where \(\phi\) is the normal pdf, and \(\Phi\) is the normal cdf, and \(x > 0\), \(s, c > 0\).

powerlognorm takes \(c\) and \(s\) as shape parameters.

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='c', default=0, min=0, max=inf, share=False, anchors=()), Parameter(name='s', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'powerlognorm'
class hypney.models.univariate_dist_list.powernorm(*args, **kwargs)

Bases: UnivariateDistribution

A power normal continuous random variable.

Notes

The probability density function for powernorm is:

\[f(x, c) = c \phi(x) (\Phi(-x))^{c-1}\]

where \(\phi\) is the normal pdf, and \(\Phi\) is the normal cdf, and \(x >= 0\), \(c > 0\).

powernorm takes c as a shape parameter for \(c\).

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='c', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'powernorm'
class hypney.models.univariate_dist_list.randint(*args, **kwargs)

Bases: UnivariateDiscreteDistribution

A uniform discrete random variable.

Notes

The probability mass function for randint is:

\[f(k) = \frac{1}{high - low}\]

for k = low, ..., high - 1.

randint takes low and high as shape parameters.

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='low', default=0, min=0, max=inf, share=False, anchors=()), Parameter(name='high', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'randint'
class hypney.models.univariate_dist_list.rayleigh(*args, **kwargs)

Bases: UnivariateDistribution

A Rayleigh continuous random variable.

Notes

The probability density function for rayleigh is:

\[f(x) = x \exp(-x^2/2)\]

for \(x \ge 0\).

rayleigh is a special case of chi with df=2.

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'rayleigh'
class hypney.models.univariate_dist_list.rdist(*args, **kwargs)

Bases: UnivariateDistribution

An R-distributed (symmetric beta) continuous random variable.

Notes

The probability density function for rdist is:

\[f(x, c) = \frac{(1-x^2)^{c/2-1}}{B(1/2, c/2)}\]

for \(-1 \le x \le 1\), \(c > 0\). rdist is also called the symmetric beta distribution: if B has a beta distribution with parameters (c/2, c/2), then X = 2*B - 1 follows a R-distribution with parameter c.

rdist takes c as a shape parameter for \(c\).

This distribution includes the following distribution kernels as special cases:

c = 2:  uniform
c = 3:  `semicircular`
c = 4:  Epanechnikov (parabolic)
c = 6:  quartic (biweight)
c = 8:  triweight
Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='c', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'rdist'
class hypney.models.univariate_dist_list.recipinvgauss(*args, **kwargs)

Bases: UnivariateDistribution

A reciprocal inverse Gaussian continuous random variable.

Notes

The probability density function for recipinvgauss is:

\[f(x, \mu) = \frac{1}{\sqrt{2\pi x}} \exp\left(\frac{-(1-\mu x)^2}{2\mu^2x}\right)\]

for \(x \ge 0\).

recipinvgauss takes mu as a shape parameter for \(\mu\).

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='mu', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'recipinvgauss'
class hypney.models.univariate_dist_list.reciprocal(*args, **kwargs)

Bases: UnivariateDistribution

A loguniform or reciprocal continuous random variable.

Notes

The probability density function for this class is:

\[f(x, a, b) = \frac{1}{x \log(b/a)}\]

for \(a \le x \le b\), \(b > a > 0\). This class takes \(a\) and \(b\) as shape parameters.

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='a', default=0, min=0, max=inf, share=False, anchors=()), Parameter(name='b', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'reciprocal'
class hypney.models.univariate_dist_list.rice(*args, **kwargs)

Bases: UnivariateDistribution

A Rice continuous random variable.

Notes

The probability density function for rice is:

\[f(x, b) = x \exp(- \frac{x^2 + b^2}{2}) I_0(x b)\]

for \(x >= 0\), \(b > 0\). \(I_0\) is the modified Bessel function of order zero (scipy.special.i0).

rice takes b as a shape parameter for \(b\).

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='b', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'rice'
class hypney.models.univariate_dist_list.semicircular(*args, **kwargs)

Bases: UnivariateDistribution

A semicircular continuous random variable.

Notes

The probability density function for semicircular is:

\[f(x) = \frac{2}{\pi} \sqrt{1-x^2}\]

for \(-1 \le x \le 1\).

The distribution is a special case of rdist with c = 3.

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'semicircular'
class hypney.models.univariate_dist_list.skellam(*args, **kwargs)

Bases: UnivariateDiscreteDistribution

A Skellam discrete random variable.

Notes

Probability distribution of the difference of two correlated or uncorrelated Poisson random variables.

Let \(k_1\) and \(k_2\) be two Poisson-distributed r.v. with expected values \(\lambda_1\) and \(\lambda_2\). Then, \(k_1 - k_2\) follows a Skellam distribution with parameters \(\mu_1 = \lambda_1 - \rho \sqrt{\lambda_1 \lambda_2}\) and \(\mu_2 = \lambda_2 - \rho \sqrt{\lambda_1 \lambda_2}\), where \(\rho\) is the correlation coefficient between \(k_1\) and \(k_2\). If the two Poisson-distributed r.v. are independent then \(\rho = 0\).

Parameters \(\mu_1\) and \(\mu_2\) must be strictly positive.

For details see: https://en.wikipedia.org/wiki/Skellam_distribution

skellam takes \(\mu_1\) and \(\mu_2\) as shape parameters.

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='mu1', default=0, min=0, max=inf, share=False, anchors=()), Parameter(name='mu2', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'skellam'
tfp_name: str = 'Skellam'
class hypney.models.univariate_dist_list.skewnorm(*args, **kwargs)

Bases: UnivariateDistribution

A skew-normal random variable.

Notes

The pdf is:

skewnorm.pdf(x, a) = 2 * norm.pdf(x) * norm.cdf(a*x)

skewnorm takes a real number \(a\) as a skewness parameter When a = 0 the distribution is identical to a normal distribution (norm). rvs implements the method of [1]_.

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='a', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'skewnorm'
class hypney.models.univariate_dist_list.t(*args, **kwargs)

Bases: UnivariateDistribution

A Student’s t continuous random variable.

For the noncentral t distribution, see nct.

Notes

The probability density function for t is:

\[f(x, \nu) = \frac{\Gamma((\nu+1)/2)} {\sqrt{\pi \nu} \Gamma(\nu/2)} (1+x^2/\nu)^{-(\nu+1)/2}\]

where \(x\) is a real number and the degrees of freedom parameter \(\nu\) (denoted df in the implementation) satisfies \(\nu > 0\). \(\Gamma\) is the gamma function (scipy.special.gamma).

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='df', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 't'
tfp_name: str = 'StudentT'
torch_name: str = 'StudentT'
class hypney.models.univariate_dist_list.trapezoid(*args, **kwargs)

Bases: UnivariateDistribution

A trapezoidal continuous random variable.

Notes

The trapezoidal distribution can be represented with an up-sloping line from loc to (loc + c*scale), then constant to (loc + d*scale) and then downsloping from (loc + d*scale) to (loc+scale). This defines the trapezoid base from loc to (loc+scale) and the flat top from c to d proportional to the position along the base with 0 <= c <= d <= 1. When c=d, this is equivalent to triang with the same values for loc, scale and c. The method of [1]_ is used for computing moments.

trapezoid takes \(c\) and \(d\) as shape parameters.

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='c', default=0, min=0, max=inf, share=False, anchors=()), Parameter(name='d', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'trapezoid'
class hypney.models.univariate_dist_list.trapz(*args, **kwargs)

Bases: UnivariateDistribution

trapz is an alias for trapezoid

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='c', default=0, min=0, max=inf, share=False, anchors=()), Parameter(name='d', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'trapz'
class hypney.models.univariate_dist_list.triang(*args, **kwargs)

Bases: UnivariateDistribution

A triangular continuous random variable.

Notes

The triangular distribution can be represented with an up-sloping line from loc to (loc + c*scale) and then downsloping for (loc + c*scale) to (loc + scale).

triang takes c as a shape parameter for \(c\).

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='c', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'triang'
class hypney.models.univariate_dist_list.truncexpon(*args, **kwargs)

Bases: UnivariateDistribution

A truncated exponential continuous random variable.

Notes

The probability density function for truncexpon is:

\[f(x, b) = \frac{\exp(-x)}{1 - \exp(-b)}\]

for \(0 <= x <= b\).

truncexpon takes b as a shape parameter for \(b\).

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='b', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'truncexpon'
class hypney.models.univariate_dist_list.truncnorm(*args, **kwargs)

Bases: UnivariateDistribution

A truncated normal continuous random variable.

Notes

The standard form of this distribution is a standard normal truncated to the range [a, b] — notice that a and b are defined over the domain of the standard normal. To convert clip values for a specific mean and standard deviation, use:

a, b = (myclip_a - my_mean) / my_std, (myclip_b - my_mean) / my_std

truncnorm takes \(a\) and \(b\) as shape parameters.

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='a', default=0, min=0, max=inf, share=False, anchors=()), Parameter(name='b', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'truncnorm'
class hypney.models.univariate_dist_list.tukeylambda(*args, **kwargs)

Bases: UnivariateDistribution

A Tukey-Lamdba continuous random variable.

Notes

A flexible distribution, able to represent and interpolate between the following distributions:

  • Cauchy (\(lambda = -1\))

  • logistic (\(lambda = 0\))

  • approx Normal (\(lambda = 0.14\))

  • uniform from -1 to 1 (\(lambda = 1\))

tukeylambda takes a real number \(lambda\) (denoted lam in the implementation) as a shape parameter.

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='lam', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'tukeylambda'
class hypney.models.univariate_dist_list.uniform(*args, **kwargs)

Bases: UnivariateDistribution

A uniform continuous random variable.

In the standard form, the distribution is uniform on [0, 1]. Using the parameters loc and scale, one obtains the uniform distribution on [loc, loc + scale].

Notes

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

torch_param_transform(params)

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'uniform'
tfp_name: str = 'Uniform'
torch_name: str = 'Uniform'
torch_param_transform(params)
class hypney.models.univariate_dist_list.vonmises(*args, **kwargs)

Bases: UnivariateDistribution

A Von Mises continuous random variable.

Notes

The probability density function for vonmises and vonmises_line is:

\[f(x, \kappa) = \frac{ \exp(\kappa \cos(x)) }{ 2 \pi I_0(\kappa) }\]

for \(-\pi \le x \le \pi\), \(\kappa > 0\). \(I_0\) is the modified Bessel function of order zero (scipy.special.i0).

vonmises is a circular distribution which does not restrict the distribution to a fixed interval. Currently, there is no circular distribution framework in scipy. The cdf is implemented such that cdf(x + 2*np.pi) == cdf(x) + 1.

vonmises_line is the same distribution, defined on \([-\pi, \pi]\) on the real line. This is a regular (i.e. non-circular) distribution.

vonmises and vonmises_line take kappa as a shape parameter.

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='kappa', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'vonmises'
tfp_name: str = 'VonMises'
torch_name: str = 'VonMises'
class hypney.models.univariate_dist_list.vonmises_line(*args, **kwargs)

Bases: UnivariateDistribution

A Von Mises continuous random variable.

Notes

The probability density function for vonmises and vonmises_line is:

\[f(x, \kappa) = \frac{ \exp(\kappa \cos(x)) }{ 2 \pi I_0(\kappa) }\]

for \(-\pi \le x \le \pi\), \(\kappa > 0\). \(I_0\) is the modified Bessel function of order zero (scipy.special.i0).

vonmises is a circular distribution which does not restrict the distribution to a fixed interval. Currently, there is no circular distribution framework in scipy. The cdf is implemented such that cdf(x + 2*np.pi) == cdf(x) + 1.

vonmises_line is the same distribution, defined on \([-\pi, \pi]\) on the real line. This is a regular (i.e. non-circular) distribution.

vonmises and vonmises_line take kappa as a shape parameter.

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='kappa', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'vonmises_line'
class hypney.models.univariate_dist_list.wald(*args, **kwargs)

Bases: UnivariateDistribution

A Wald continuous random variable.

Notes

The probability density function for wald is:

\[f(x) = \frac{1}{\sqrt{2\pi x^3}} \exp(- \frac{ (x-1)^2 }{ 2x })\]

for \(x >= 0\).

wald is a special case of invgauss with mu=1.

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'wald'
class hypney.models.univariate_dist_list.weibull_max(*args, **kwargs)

Bases: UnivariateDistribution

Weibull maximum continuous random variable.

The Weibull Maximum Extreme Value distribution, from extreme value theory (Fisher-Gnedenko theorem), is the limiting distribution of rescaled maximum of iid random variables. This is the distribution of -X if X is from the weibull_min function.

Notes

The probability density function for weibull_max is:

\[f(x, c) = c (-x)^{c-1} \exp(-(-x)^c)\]

for \(x < 0\), \(c > 0\).

weibull_max takes c as a shape parameter for \(c\).

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='c', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'weibull_max'
class hypney.models.univariate_dist_list.weibull_min(*args, **kwargs)

Bases: UnivariateDistribution

Weibull minimum continuous random variable.

The Weibull Minimum Extreme Value distribution, from extreme value theory (Fisher-Gnedenko theorem), is also often simply called the Weibull distribution. It arises as the limiting distribution of the rescaled minimum of iid random variables.

Notes

The probability density function for weibull_min is:

\[f(x, c) = c x^{c-1} \exp(-x^c)\]

for \(x > 0\), \(c > 0\).

weibull_min takes c as a shape parameter for \(c\). (named \(k\) in Wikipedia article and \(a\) in numpy.random.weibull). Special shape values are \(c=1\) and \(c=2\) where Weibull distribution reduces to the expon and rayleigh distributions respectively.

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='c', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'weibull_min'
tfp_name: str = 'Weibull'
torch_name: str = 'Weibull'
class hypney.models.univariate_dist_list.wrapcauchy(*args, **kwargs)

Bases: UnivariateDistribution

A wrapped Cauchy continuous random variable.

Notes

The probability density function for wrapcauchy is:

\[f(x, c) = \frac{1-c^2}{2\pi (1+c^2 - 2c \cos(x))}\]

for \(0 \le x \le 2\pi\), \(0 < c < 1\).

wrapcauchy takes c as a shape parameter for \(c\).

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='scale', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='c', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'wrapcauchy'
class hypney.models.univariate_dist_list.yulesimon(*args, **kwargs)

Bases: UnivariateDiscreteDistribution

A Yule-Simon discrete random variable.

Notes

The probability mass function for the yulesimon is:

\[f(k) = \alpha B(k, \alpha+1)\]

for \(k=1,2,3,...\), where \(\alpha>0\). Here \(B\) refers to the scipy.special.beta function.

The sampling of random variates is based on pg 553, Section 6.3 of [1]. Our notation maps to the referenced logic via \(\alpha=a-1\).

For details see the wikipedia entry [2].

References

1

Devroye, Luc. “Non-uniform Random Variate Generation”, (1986) Springer, New York.

2

https://en.wikipedia.org/wiki/Yule-Simon_distribution

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
tfp_name
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='alpha', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'yulesimon'
class hypney.models.univariate_dist_list.zipf(*args, **kwargs)

Bases: UnivariateDiscreteDistribution

A Zipf discrete random variable.

Notes

The probability mass function for zipf is:

\[f(k, a) = \frac{1}{\zeta(a) k^a}\]

for \(k \ge 1\).

zipf takes \(a\) as shape parameter. \(\zeta\) is the Riemann zeta function (scipy.special.zeta)

Attributes
backend

Return tensor backend module (ep.xxx)

data
defaults
n_dim
param_names
quantiles
simulate_partially_efficient
torch_name

Methods

__call__(**kwargs)

Call self as a function.

cut(*args[, cut_data, cut_type, ...])

Return new model with observables cut to a rectangular region

dist_for_data()

Return distribution from library appropriate to self.data

fix([params])

Return model with parameters in fix fixed

fix_except([keep])

Return new model with only parameters named in keep; other parameters will be fixed to their defaults.

freeze()

Return new model that takes no parameters.

load(filename)

Load model from a gzipped pickle file

normalized_data()

Return model for data that was normalized using the current model's mean and standard deviation.

save(filename)

Save model to a gzipped pickle file

scale([scale])

Return model for data that has been scaled

set(*[, name, data, quantiles, params])

Return a model with possibly changed name, defaults, data, or parameters

shift([shift])

Return model for data that has been shifted

shift_and_scale([shift, scale])

Return model for data that has been shifted, then scaled, by constants.

validate_data(data)

Return eagerpy tensor from data

validate_params([params, set_defaults])

Return dictionary of parameters for the model

validate_quantiles(quantiles)

Return an (n_events) eagerpy tensor from quantiles

cdf

diff_rate

log_diff_rate

logpdf

max

mean

min

mix_with

param_spec_for

pdf

plot_cdf

plot_diff_rate

plot_pdf

ppf

rate

reparametrize

rvs

simulate

std

support

tensor_with

tf_param_transform

torch_param_transform

var

param_specs: ty.Tuple[hypney.Parameter] = (Parameter(name='rate', default=1.0, min=0, max=inf, share=False, anchors=()), Parameter(name='loc', default=0.0, min=-inf, max=inf, share=False, anchors=()), Parameter(name='a', default=0, min=0, max=inf, share=False, anchors=()))
scipy_name: str = 'zipf'
tfp_name: str = 'Zipf'

Module contents