question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

VotingChainladder enhancements

See original GitHub issue

Would like to get additional model properties functioning with the VotingChainladder estimator prior to release.

import chainladder as cl
raa = cl.load_sample('RAA')

bcl1 = cl.Pipeline(steps=[('dev', cl.Development(average='volume')), ('model', cl.Chainladder())])
bcl2 = cl.Pipeline(steps=[('dev', cl.Development(average='simple')), ('model', cl.Chainladder())])

estimators = [('bcl1', bcl1), ('bcl2', bcl2)]
vot = cl.VotingChainladder(estimators=estimators)
vot.fit(raa)

assert abs((bcl1.fit(raa).named_steps['model'].full_expectation_ + bcl2.fit(raa).named_steps['model'].full_expectation_)/2 - vot.full_expectation_).max().max()< 1e-4

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
jbogaardtcommented, Feb 3, 2021

2. if origins provided (e.g. through dict) check that all origin periods are allocated and apply the default for unallocated (in future perhaps provide choice of functionality for omitted origins, e.g. applying first estimator). Provide an exception on origins that don’t exist.

This may help reduce the complexity of the dictionary approach:

import chainladder as cl
raa = cl.load_sample('raa')

dict_weight = {'1989':(1, 0), '1988': (0.75, 0.25)}

# Convert dict_weight into a mapping dictionary
mapping_dict = {raa.origin[raa.origin==k][0] :v for k, v in dict_weight.items()}
# Fill in missing values
missing = {k: (0.5, 0.5) for k in raa.origin[~raa.origin.isin(mapping_dict.keys())]}

# Use it in same way as the callable method
raa.origin.map({**mapping_dict, **missing})
1reaction
cbalonacommented, Feb 3, 2021

There also appears to be some unaccounted for mutation/side-effect we should resolve. Notice the second “refit” of the estimator.

This is due to adding a new axis so that the weights can multiply with the ultimates. When refitting, it is adding a 6th axis. Should be a quick easy fix. It may also be avoided through better handling of the weights as per my previous comment.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Releases & Changelog — Reserving in Python
#117 - VotingChainladder enhancements to allow for more flexibility in defining weights (courtesy of @cbalona). Bug Fixes.
Read more >
chainladder: Versions | Openbase
#131 - Added a BarnettZenwirth development estimator; #117 - VotingChainladder enhancements to allow for more flexibility in defining weights (courtesy of ...
Read more >
Additive Enhancements (Commander / EDH MTG Deck)
Additive Enhancements · Enchantment (26) · Sorcery (6) · Creature (21) · Instant (6) · Artifact (3) · Planeswalker (1) · Commander (1)...
Read more >
Game of Thrones Conquest: Building Enhancements - YouTube
Everything you want to know about building enhancements and which ones may help you most as a new player. GOTC tips!
Read more >
chainladder - Property and Casualty Loss Reserving in Python
VotingChainladder enhancements. Would like to get additional model properties functioning with the VotingChainladder estimator prior to ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found