chainladder.TweedieGLM

Contents

chainladder.TweedieGLM#

class chainladder.TweedieGLM(design_matrix='C(development) + C(origin)', response=None, weight=None, power=1.0, alpha=1.0, link='log', max_iter=100, tol=0.0001, warm_start=False, verbose=0)#

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.

New in version 0.8.1.

Parameters:
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.

weight: str

Column name of any weight to use in the GLM. If none specified, then an unweighted regression will be performed.

power: float, default=0

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 = 0 is equivalent to unpenalized GLMs. In this case, the design matrix X must have full column rank (no collinearities).

link: {‘auto’, ‘identity’, ‘log’}, default=’auto’

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} <= tol where g_j is 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 to fit as initialization for coef_ and intercept_ .

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

Methods

fit_transform(X[, y])

Fit to data, then transform it.

get_metadata_routing()

Get metadata routing of this object.

get_params([deep])

Get parameters for this estimator.

set_backend(backend[, inplace, deep])

Converts triangle array_backend.

set_fit_request(*[, sample_weight])

Request metadata passed to the fit method.

set_output(*[, transform])

Set output container.

set_params(**params)

Set the parameters of this estimator.

to_json()

Serializes triangle object to json format

to_pickle(path[, protocol])

Serializes triangle object to pickle.

fit

pipe

transform