TweedieGLM#
- class chainladder.TweedieGLM(design_matrix='C(development) + C(origin)', response=None, power=1.0, alpha=1.0, link='log', max_iter=100, tol=0.0001, warm_start=False, verbose=0, drop=None, drop_valuation=None)[source]#
This estimator creates development patterns with a GLM using a Tweedie distribution.
The Tweedie family includes several of the more popular distributions including the normal, ODP poisson, and gamma distributions. This class is a special case of DevleopmentML. It restricts to just GLM using a TweedieRegressor and provides an R-like formulation of the design matrix.
Added in version 0.8.1.
- Parameters:
- drop: tuple or list of tuples
Drops specific origin/development combination(s)
- drop_valuation: str or list of str (default = None)
Drops specific valuation periods. str must be date convertible.
- design_matrix: formula-like
A patsy formula describing the independent variables, X of the GLM
- response: str
Column name for the reponse variable of the GLM. If ommitted, then the first column of the Triangle will be used.
- power: float, default=1
The power determines the underlying target distribution according to the following table: +——-+————————+ | Power | Distribution | +=======+========================+ | 0 | Normal | +——-+————————+ | 1 | Poisson | +——-+————————+ | (1,2) | Compound Poisson Gamma | +——-+————————+ | 2 | Gamma | +——-+————————+ | 3 | Inverse Gaussian | +——-+————————+ For
0 < power < 1, no distribution exists.- alpha: float, default=1
Constant that multiplies the penalty term and thus determines the regularization strength.
alpha = 0is equivalent to unpenalized GLMs. In this case, the design matrix X must have full column rank (no collinearities).- link: {‘auto’, ‘identity’, ‘log’}, default=’log’
The link function of the GLM, i.e. mapping from linear predictor X @ coeff + intercept to prediction y_pred. Option ‘auto’ sets the link depending on the chosen family as follows: - ‘identity’ for Normal distribution - ‘log’ for Poisson, Gamma and Inverse Gaussian distributions
- max_iter: int, default=100
The maximal number of iterations for the solver.
- tol: float, default=1e-4
Stopping criterion. For the lbfgs solver, the iteration will stop when
max{|g_j|, j = 1, ..., d} <= tolwhereg_jis the j-th component of the gradient (derivative) of the objective function.- warm_start: bool, default=False
If set to
True, reuse the solution of the previous call tofitas initialization forcoef_andintercept_.- verbose: int, default=0
For the lbfgs solver set verbose to any positive number for verbosity.
- Attributes:
- model_: sklearn.Pipeline
A scikit-learn Pipeline of the GLM
Inherited Methods
|
Fit to data, then transform it. |
|
Get metadata routing of this object. |
|
Get parameters for this estimator. |
|
|
|
Converts triangle array_backend. |
|
Set output container. |
|
Set the parameters of this estimator. |
|
Serializes triangle object to json format |
|
Serializes triangle object to pickle. |