Distribution#

class pygam.distributions.Distribution(name=None, scale=None)[source]#

Bases: Core

Base Distribution class.

Parameters:
namestr, default: None
scalefloat or None, default: None

scale/standard deviation of the distribution

Methods

get_params([deep])

Returns a dict of all of the object's user-facing parameters.

phi(y, mu, edof, weights)

Related to GLM scale parameter.

sample(mu)

Return random samples from this distribution.

set_params([deep, force])

Sets an object's parameters.

get_params(deep=False)[source]#

Returns a dict of all of the object’s user-facing parameters.

Parameters:
deepboolean, default: False

when True, also gets non-user-facing parameters

Returns:
dict
phi(y, mu, edof, weights)[source]#

Related to GLM scale parameter. for Binomial and Poisson families this is unity for Normal family this is variance.

Parameters:
yarray-like of length n

target values

muarray-like of length n

expected values

edoffloat

estimated degrees of freedom

weightsarray-like shape (n,) or None, default: None

sample weights if None, defaults to array of ones

Returns:
scaleestimated model scale
abstractmethod sample(mu)[source]#

Return random samples from this distribution.

Parameters:
muarray-like of shape n_samples or shape (n_simulations, n_samples)

expected values

Returns:
random_samplesnp.array of same shape as mu
set_params(deep=False, force=False, **parameters)[source]#

Sets an object’s parameters.

Parameters:
deepboolean, default: False

when True, also sets non-user-facing parameters

forceboolean, default: False

when True, also sets parameters that the object does not already have

**parametersparameters to set
Returns:
self