Skip to content

Commit

Permalink
misc doc update
Browse files Browse the repository at this point in the history
  • Loading branch information
Erik Bernhardsson committed Aug 2, 2019
1 parent d944667 commit ab9f9cc
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions convoys/regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,18 @@ class RegressionModel(object):
class GeneralizedGamma(RegressionModel):
''' Generalization of Gamma, Weibull, and Exponential
:param ci: boolean, defaults to False. Whether to use MCMC to
sample from the posterior so that a confidence interval can be
estimated later (see :meth:`cdf`).
:param hierarchical: boolean denoting whether we have a (Normal) prior
on the alpha and beta parameters to regularize. The variance of
the normal distribution is in itself assumed to be an inverse
gamma distribution (1, 1).
:param flavor: defaults to logistic. If set to 'linear', then an
linear model is fit, where the beta params will be completely
additive. This creates a much more interpretable model, with some
minor loss of accuracy.
This mostly follows the `Wikipedia article
<https://en.wikipedia.org/wiki/Generalized_gamma_distribution>`_, although
our notation is slightly different. Also see `this paper
Expand Down Expand Up @@ -264,6 +276,20 @@ def callback(LL, value_history=[]):
} for k, data in result.items()}

def cdf(self, x, t, ci=None):
'''Returns the value of the cumulative distribution function
for a fitted model. TODO: this should probably be renamed
"predict" in the future to follow the scikit-learn convention.
:param x: feature vector (or matrix)
:param t: time
:param ci: if this is provided, and the model was fit with
`ci = True`, then the return value will contain one more
dimension, and the last dimension will have size 3,
containing the mean, the lower bound of the confidence
interval, and the upper bound of the confidence interval.
If this is not provided, then the max a posteriori
prediction will be used.
'''
x = numpy.array(x)
t = numpy.array(t)
if ci is None:
Expand Down

0 comments on commit ab9f9cc

Please sign in to comment.