chainladder.BornhuetterFerguson#
- class chainladder.BornhuetterFerguson(apriori=1.0, apriori_sigma=0.0, random_state=None)[source]#
The deterministic Bornhuetter Ferguson IBNR model
- Parameters:
- apriori: float, optional (default=1.0)
Multiplier for the sample_weight used in the Bornhuetter Ferguson method. If sample_weight is already an apriori measure of ultimate, then use 1.0. The recommended pratice is to seperate the model parameter assumption and data apart. For example, if the apriori s 80% of premium, it is recommended to set the aprior as 0.8 and leave the premium data in sample_weight argument unmodified.
- apriori_sigma: float, optional (default=0.0)
Standard deviation of the apriori. When used in conjunction with the bootstrap model, the model samples aprioris from a lognormal distribution using this argument as a standard deviation.
- random_state: int, RandomState instance or None, optional (default=None)
Seed for sampling from the apriori distribution. This is ignored when using as a deterministic method. If int, random_state is the seed used by the random number generator; If RandomState instance, random_state is the random number generator; If None, the random number generator is the RandomState instance used by np.random.
- Attributes:
- ultimate_: Triangle
The ultimate losses per the method
- ibnr_: Triangle
The IBNR per the method
Methods
fit(X[, y, sample_weight])Applies the Bornhuetter-Ferguson technique to triangle X
get_metadata_routing()Get metadata routing of this object.
get_params([deep])Get parameters for this estimator.
intersection(a, b)Given two Triangles with mismatched indices, this method aligns their indices
predict(X[, sample_weight])Predicts the Bornhuetter-Ferguson ultimate on a new triangle X
set_backend(backend[, inplace, deep])Converts triangle array_backend.
set_fit_request(*[, sample_weight])Configure whether metadata should be requested to be passed to the
fitmethod.set_params(**params)Set the parameters of this estimator.
set_predict_request(*[, sample_weight])Configure whether metadata should be requested to be passed to the
predictmethod.to_json()Serializes triangle object to json format
to_pickle(path[, protocol])Serializes triangle object to pickle.
fit_predict
pipe
validate_X
validate_weight
Examples
Bornhuetter-Ferguson requires an apriori expected ultimate per origin, supplied through
sample_weight.A common idiom for building a flat per-origin apriori is to take any same-shape Triangle, zero it out, and add the desired value. Here is an example.
raa = cl.load_sample("raa") premium = raa.latest_diagonal * 0 + 40_000 # zero out and add 40,000 to each origin ibnr = cl.BornhuetterFerguson(apriori=0.7).fit(X=raa, sample_weight=premium).ibnr_ print(ibnr)
2261 1981 NaN 1982 255.707763 1983 717.772687 1984 1596.061515 1985 2658.738155 1986 5239.441491 1987 8574.335344 1988 12714.889984 1989 18585.219714 1990 24861.068855
One might be tempted to set never set the aprior and modify the sample_weight directly, and they will result in the same answer, but this is not the recommended practice. It not only add confusion, but it alos mixes the model parameter assumption and data together.
raa = cl.load_sample("raa") premium = raa.latest_diagonal * 0 + 40_000 * 0.7 # premium is modified by 70% ibnr = cl.BornhuetterFerguson().fit(X=raa, sample_weight=premium).ibnr_ print(ibnr)
2261 1981 NaN 1982 255.707763 1983 717.772687 1984 1596.061515 1985 2658.738155 1986 5239.441491 1987 8574.335344 1988 12714.889984 1989 18585.219714 1990 24861.068855