Expected Loss Method #329
Replies: 2 comments 12 replies
-
I think the doc could use another round of revamp, there are some known issues outstanding, for example codes not compiling even though the source codes are fine. Anyways... Yes, 1 and 2 are relatively easy. xyz = cl.load_sample("xyz")
cl_mod = cl.Chainladder().fit(xyz["Incurred"])
cl_mod.ultimate_ / xyz["Premium"].latest_diagonal To do 3. We'll need to get the average prior LRs first, this can only be done with the help of pandas: elr = (
(cl_mod.ultimate_ / xyz["Premium"].latest_diagonal)
.to_frame(origin_as_datetime=True)
.iloc[4:-3]
.mean()
)
elr.iloc[0] Fit a new model using expected loss ratio: el_mod = cl.ExpectedLoss(apriori=elr.iloc[0]).fit(
xyz["Incurred"], sample_weight=xyz["Premium"].latest_diagonal
)
el_mod.ultimate_ Then, use model_weights = np.array([[1, 0]] * 8 + [[0, 1]] * 3)
vot_mod = cl.VotingChainladder(
estimators=[("cl", cl_mod), ("el", el_mod)], weights=model_weights
).fit(xyz["Incurred"], sample_weight=xyz["Premium"].latest_diagonal)
vot_mod.ultimate_ |
Beta Was this translation helpful? Give feedback.
-
same could be said about the age-to-age averages. you could always judgmentally select them.
still a piece of code outside of the cl pipelines
not meta enough. sklearn doesn't make ppl exit and do preprocessing in np. |
Beta Was this translation helpful? Give feedback.
-
noticed this method was missing from the API reference.
https://chainladder-python.readthedocs.io/en/latest/modules/api.html#module-chainladder.methods
is it possible to do the following all within the cl package, without resorting to pandas manipulation?
Beta Was this translation helpful? Give feedback.
All reactions