openest.models.spline_model module¶
-
class
openest.models.spline_model.SplineModel(xx_is_categorical=False, xx=None, conditionals=None, scaled=True)[source]¶ Bases:
openest.models.univariate_model.UnivariateModel,openest.models.memoizable.MemoizableUnivariateModel Spline File
Each line in a model spline file represents a polynomial segment in log-probability space. The format is as follows:
spp1 <x>,<y0>,<y1>,<a0>,<a1>,<a2> ...
Each line describes a segment of a probability distribution of y, conditional on x =
<x>. The segment spans from<y0>to<y1>, where the lowest value of<y0>may be-inf, and the highest value of<y1>may beinf. The<x>values may also be categorical or numerical. If they are numerical, it is assumed that these values represent samples of a smoothly varying function (a cubic spline in every y).The values
<a0>,<a1>and<a2>are the polynomial coefficients in y (with quadratic coefficients, only normal or exponential tails are possible). The final segment of the probability function is:exp(a0 + a1 y + a2 y2)
Parameters: - xx_is_categorical (bool) –
- xx (list-like) –
- conditionals –
- scaled (bool) –
-
static
create_gaussian(xxs, order=None, xx_is_categorical=True)[source]¶ xxs should be a dictionary of the form {x: (mean, variance)}.
-
eval_pval(x, p, threshold=0.001)[source]¶ Inverse CDF Evaluation
Returns the value of $y$ that corresponds to a given p-value: $F^{-1}(p | x)$.
-
neginf= -inf¶
-
posinf= inf¶
-
recategorize_x(oldxx, newxx)[source]¶ Construct a new model with categorical x values ‘newxx’, using the conditionals currently assigned to categorical x values ‘oldxx’.
-
samples= 1000¶
-
scale_p(a)[source]¶ Raise the distribution to the power ‘a’ and rescales.
Returns: modifies this model and returns it Return type: self
-
scale_y(a)[source]¶ Rescaling of the Parameter Dimension
Produces a new conditional PDF with the $y$ dimension scaled by a constant: $p(z | x) = p( rac{y}{a} | x)$.