Tail model configurations¶
GeneralizedBondy
¶
- class ledger_analytics.GeneralizedBondy(id: str, name: str, model_type: str, config: dict[str, Any] | None, model_class: str, endpoint: str, requester: Requester, asynchronous: bool = False)¶
GeneralizedBondy.
This model implements, by default, a Bayesian version of the Generalized Bondy tail development model, with the form:
\[\begin{split}\mathrm{LR}_{ij} &\sim \mathrm{Gamma(\mu_{ij}, \sigma_{ij}^2)}\\ \mu_{ij} &= ATA_{j} y_{ij - 1}\\ ATA_{j} &= \exp( ATA_{\text{init}} \beta^{j} )\\ \sigma_{ij}^2 &= \exp(\sigma_{\text{int}} + \sigma_{\text{slope}} j - \log(\mathrm{EP}_{i})), \quad{\forall j \in [1, M]}\end{split}\]See the model-specific documentation in the User Guide for more details.
The fit and predict configurations are controlled by
Config
andPredictConfig
classes, respectively.- class Config(*, loss_family: ~typing.Annotated[~typing.Literal['Gamma', 'Lognormal', 'Normal', 'InverseGaussian'], ~pydantic.functional_validators.BeforeValidator(func=~ledger_analytics.config.<lambda>, json_schema_input_type=PydanticUndefined)] = 'Gamma', loss_definition: ~typing.Literal['paid', 'reported', 'incurred'] = 'paid', recency_decay: str | float | None = None, line_of_business: str | None = None, min_rel_pred: float = 0.0, dev_lag_intercept: float = 0.0, priors: dict[str, list[float] | float] | None = None, informed_priors_version: str | None = None, autofit_override: dict[str, float | int | None] = None, prior_only: bool = False, seed: int | None = None)¶
GeneralizedBondy model configuration class.
- loss_family¶
the likelihood family to use. One of
"Gamma"
,"Lognormal"
,"Normal"
or"InverseGaussian"
. Defaults to"Gamma"
. See theLossFamily
type hint class inledger_analytics.config
.- Type:
Literal[‘Gamma’, ‘Lognormal’, ‘Normal’, ‘InverseGaussian’]
- loss_definition¶
the field to model in the triangle. One of
"paid"
"reported"
or"incurred"
.- Type:
Literal[‘paid’, ‘reported’, ‘incurred’]
- recency_decay¶
geometric decay parameter to downweight earlier diagonals (see Modeling rationale… section in the User Guide). Defaults to 1.0 for no geometric decay. Can be
"lookup"
to choose based online_of_business
.- Type:
str | float | None
- line_of_business¶
Line of business used to specify informed priors. Must be provided if
informed_priors_version
is notNone
.- Type:
str | None
- min_rel_pred¶
Minimum relative prediction for the one-step ahead predictions. This is a multiplier of the previous period’s loss. Setting to 1.0 indicates that future losses should be strictly at least the prior period’s loss amount, avoiding negative development patterns.
- Type:
float
- dev_lag_intercept¶
the development lag offset to apply in the exponential of the Bondy exponent term. By default, this is 0.0, but can be set to a suitable development lag (in months) to center the Bondy parameters.
- Type:
float
- priors¶
dictionary of priors. Defaults to
None
to use the default priors. See the DefaultPriors class for default (non line-of-business) priors.- Type:
dict[str, list[float] | float] | None
- informed_priors_version¶
If
line_of_business
is set, the priors are based on Ledger Investing’s proprietary values derived from industry data."latest"
uses priors derived from the most recent industry data. Defaults toNone
.- Type:
str | None
- autofit_override¶
override the MCMC autofitting procedure arguments. See the documentation for a fully description of options in the User Guide.
- Type:
dict[str, float | int | None]
- prior_only¶
should a prior predictive simulation be run?
- Type:
bool
- seed¶
Seed to use for model sampling. Defaults to
None
, but it is highly recommended to set.- Type:
int | None
- class DefaultPriors(value)¶
Default priors for GeneralizedBondy.
Attributes:
- class PredictConfig(*, max_dev_lag: float | None = None, max_eval: date | None = None, eval_resolution: tuple[int, str] | None = None, include_process_risk: bool = True)¶
Sherman
¶
- class ledger_analytics.Sherman(id: str, name: str, model_type: str, config: dict[str, Any] | None, model_class: str, endpoint: str, requester: Requester, asynchronous: bool = False)¶
Sherman.
This model implements, by default, a Bayesian version of Sherman (1984)’s inverse power curve tail development model,
- Sherman, RE (1984). Extrapolating, smoothing and interpolating
development factors. PCAS 71, p. 122-155.
It has the form:
\[\begin{split}\mathrm{LR}_{ij} &\sim \mathrm{Gamma(\mu_{ij}, \sigma_{ij}^2)}\\ \mu_{ij} &= ATA_{ij} y_{ij - 1}\\ ATA_{j} &= 1 + \exp( ATA_{\text{int}} - \beta \log(j) )\\ \sigma_{ij}^2 &= \exp(\sigma_{\text{int}} + \sigma_{\text{slope}} j - \log(\mathrm{EP}_{i})), \quad{\forall j \in [1, M]}\end{split}\]See the model-specific documentation in the User Guide for more details.
The fit and predict configurations are controlled by
Config
andPredictConfig
classes, respectively.- class Config(*, loss_family: ~typing.Annotated[~typing.Literal['Gamma', 'Lognormal', 'Normal', 'InverseGaussian'], ~pydantic.functional_validators.BeforeValidator(func=~ledger_analytics.config.<lambda>, json_schema_input_type=PydanticUndefined)] = 'Gamma', loss_definition: ~typing.Literal['paid', 'reported', 'incurred'] = 'paid', recency_decay: str | float | None = None, line_of_business: str | None = None, min_rel_pred: float = 0.0, dev_lag_intercept: float = 0.0, priors: dict[str, list[float] | float] | None = None, autofit_override: dict[str, float | int | None] = None, prior_only: bool = False, seed: int | None = None)¶
Sherman model configuration class.
- loss_family¶
the likelihood family to use. One of
"Gamma"
,"Lognormal"
,"Normal"
or"InverseGaussian"
. Defaults to"Gamma"
. See theLossFamily
type hint class inledger_analytics.config
.- Type:
Literal[‘Gamma’, ‘Lognormal’, ‘Normal’, ‘InverseGaussian’]
- loss_definition¶
the field to model in the triangle. One of
"paid"
"reported"
or"incurred"
.- Type:
Literal[‘paid’, ‘reported’, ‘incurred’]
- recency_decay¶
geometric decay parameter to downweight earlier diagonals (see Modeling rationale… section in the User Guide). Defaults to 1.0 for no geometric decay. Can be
"lookup"
to choose based online_of_business
.- Type:
str | float | None
- min_rel_pred¶
Minimum relative prediction for the one-step ahead predictions. This is a multiplier of the previous period’s loss. Setting to 1.0 indicates that future losses should be strictly at least the prior period’s loss amount, avoiding negative development patterns.
- Type:
float
- dev_lag_intercept¶
the development lag offset to apply in the exponential of the Bondy exponent term. By default, this is 0.0, but can be set to a suitable development lag (in months) to center the Bondy parameters.
- Type:
float
- priors¶
dictionary of priors. Defaults to
None
to use the default priors. See the DefaultPriors class for default (non line-of-business) priors.- Type:
dict[str, list[float] | float] | None
- autofit_override¶
override the MCMC autofitting procedure arguments. See the documentation for a fully description of options in the User Guide.
- Type:
dict[str, float | int | None]
- prior_only¶
should a prior predictive simulation be run?
- Type:
bool
- seed¶
Seed to use for model sampling. Defaults to
None
, but it is highly recommended to set.- Type:
int | None
- class DefaultPriors(value)¶
Default priors for Sherman.
Attributes:
- class PredictConfig(*, max_dev_lag: float | None = None, max_eval: date | None = None, eval_resolution: tuple[int, str] | None = None, include_process_risk: bool = True)¶
ClassicalPowerTransformTail
¶
- class ledger_analytics.ClassicalPowerTransformTail(id: str, name: str, model_type: str, config: dict[str, Any] | None, model_class: str, endpoint: str, requester: Requester, asynchronous: bool = False)¶
ClassicalPowerTransformTail model.
This model implements a generalization of classical power transform tail models on age-to-age factors (ATAs) which, by default, fits a model with maximum likelihood estimation of the form:
\[\begin{split}\log ATA_{j} &\sim \mathrm{Normal(\mu_{j}, \sigma^2)}\\ \mu_{j} &= \beta_{\text{int}} + \beta_{j} \text{L}_j\\ \beta_{j} &= \lambda - 1 - \beta_{\text{slope}}\\ \text{L}_j &= j^{\lambda-1} / \lambda\end{split}\]where \(\log ATA\) represents log-scale ATAs, and \(\lambda`\) is a Box-Cox transformation parameter. The latter can be set to switch between exponential decay, Sherman and Clark square-root tail models. See the model-specific documentation in the User Guide for more details.
The fit and predict configurations are controlled by
Config
andPredictConfig
classes, respectively.- class Config(*, loss_definition: Literal['paid', 'reported', 'incurred'] = 'paid', lambda_: float = 1.0, recency_decay: str | float | None = None, min_rel_pred: float = 0.0, priors: dict[str, list[float] | float] | None = None, prior_only: bool = False, seed: int | None = None)¶
ClassicalPowerTransformTail model configuration class.
- loss_definition¶
the field to model in the triangle. One of
"paid"
"reported"
or"incurred"
.- Type:
Literal[‘paid’, ‘reported’, ‘incurred’]
- lambda_¶
Box-Cox transformation parameter applied to development lag (as measured in years).
lambda_=1.0
is equivalent to the exponential decay tail model.lambda_=0.0
is equivalent to the Sherman inverse-power tail model.lambda_=0.5
is equivalent to the Clark square-root tail model.- Type:
float
- recency_decay¶
geometric decay parameter to downweight earlier diagonals (see Modeling rationale… section in the User Guide). Defaults to 1.0 for no geometric decay. Can be
"lookup"
to choose based online_of_business
.- Type:
str | float | None
- min_rel_pred¶
Minimum relative prediction for the one-step ahead predictions. This is a multiplier of the previous period’s loss. Setting to 1.0 indicates that future losses should be strictly at least the prior period’s loss amount, avoiding negative development patterns.
- Type:
float
- priors¶
dictionary of priors. Defaults to
None
to use the default priors. See the DefaultPriors class for default (non line-of-business) priors.- Type:
dict[str, list[float] | float] | None
- prior_only¶
should a prior predictive simulation be run?
- Type:
bool
- seed¶
Seed to use for model sampling. Defaults to
None
, but it is highly recommended to set.- Type:
int | None
- class DefaultPriors(value)¶
Default priors for ClassicalPowerTransformTail.
Attributes:
- class PredictConfig(*, max_dev_lag: float | None = None, max_eval: date | None = None, eval_resolution: tuple[int, str] | None = None, include_process_risk: bool = True)¶