chainladder-python
chainladder-python copied to clipboard
Latest n diagonal in heatmap()
Is there an easy way to heatmap()
only the latest n diagonal? I supposed we can add in another parameter, I propose last_n_diagonal
, default to None
?
Yes, you can use the Development
estimator to omit any link ratios and those should propagate to the heatmap.
import chainladder as cl
cl.Development(n_periods=3).fit_transform(cl.load_sample('raa')).link_ratio.heatmap()
Ahh, similar solution to what I came up with.
raa = cl.load_sample("raa")
cl.Development().fit_transform(raa[raa.valuation.year >= raa.valuation_date.year-3]).link_ratio.heatmap()
I think I am getting better at this. Only problem is now we can't see the older link ratios.😅
Cool. By your approach you don't even need the Development
estimator:
raa = cl.load_sample('raa')
raa.link_ratio[raa.link_ratio.valuation.year >= raa.valuation_date.year-3].heatmap()
Yes, even better!
Should this be reclassifed discussion forum Q&A?
Yes, unless you think it's useful to add an argument to only heatmap the last n diagonals? It's a bit better as we can see the older diagonals that are not heat-mapped. But it will mean that it's another piece of code that we have to maintain. What do you think?
I fear n_diagonals will be short lived. Eventually someone will want the same but with drop_hi and drop_low. I dont want to create more args for those use cases.
Maybe it's better to create a Boolean arg in heatmap that allows the dropped link ratios from the Development estimator to be visible or not.
That's actually a great idea. I like that.
With this we should be able to see if the remaining LDFs have any patterns.