Smoother
smoother.Smoother
class smoother.Smoother(lb=0, ub=1, num=50) [source]
The smoother computes a distribution by maximizing an objective function (i.e. a smoothness function) given constraints.
Attributes: | x : np.array
A linearly spaced (
The probability density function of
The cumulative distribution function of |
---|
Methods
mean(self) [source]
Returns: | mean : float
|
---|
var(self) [source]
Returns: | variance : float
|
---|
std(self) [source]
Returns: | standard deviation : float
|
---|
median(self) [source]
Returns: | median : float
|
---|
entropy(self) [source]
Returns: | entropy : float
|
---|
pdf(self, x) [source]
Parameters: | x : float
|
---|---|
Returns: | pdf(x) : float
Probability density function of |
cdf(self, x) [source]
Parameters: | x : float
|
---|---|
Returns: | cdf(x) : float between 0. and 1.
Cumulative distribution function of |
ppf(self, q) [source]
Parameters: | q : float between 0. and 1.
Quantile. |
---|---|
Returns: | ppf(q) : float
Percent point function; inverse of |
sf(self, x) [source]
Parameters: | x : float
|
---|---|
Returns: | sf(x) : float between 0. and 1.
Survival function; |
isf(self, q) [source]
Parameters: | q : float between 0. and 1.
|
---|---|
Returns: | isf(x) : float
Inverse survival function. |
moment(self, degree=1, type_='raw', norm=False) [source]
Parameters: | degree : int, default=1
The degree of the moment, e.g. first (mean), second (var). type_ : str, default='raw' Type of moment; |
---|---|
Returns: | moment : float
|
fit(self, lb, ub, constraints, objective=lambda self: self.entropy(), num=50) [source]
Parameters: | lb : scalar
Lower bound of the distribution. ub : scalarUpper bound of the distribution. constraints : list of callables
Constraints take in a
The objective or smoothing function. The objective function takes a Number of points on the distribution used for approximation. |
---|---|
Returns: | self :
|
dump(self) [source]
Returns: | state_dict : dict
JSON dump of the state dictionary. |
---|
load(state_dict) [source]
Parameters: | state_dict : dict
Output of |
---|---|
Returns: | smoother : Smoother
Smoother with the specified state dictionary. |