def test_pipeline(): tri = cl.load_sample('clrd').groupby('LOB').sum()[[ 'CumPaidLoss', 'IncurLoss', 'EarnedPremDIR' ]] tri['CaseIncurredLoss'] = tri['IncurLoss'] - tri['CumPaidLoss'] X = tri[['CumPaidLoss', 'CaseIncurredLoss']] sample_weight = tri['EarnedPremDIR'].latest_diagonal dev = [ cl.Development(), cl.ClarkLDF(), cl.Trend(), cl.IncrementalAdditive(), cl.MunichAdjustment(paid_to_incurred=('CumPaidLoss', 'CaseIncurredLoss')), cl.CaseOutstanding(paid_to_incurred=('CumPaidLoss', 'CaseIncurredLoss')) ] tail = [cl.TailCurve(), cl.TailConstant(), cl.TailBondy(), cl.TailClark()] ibnr = [ cl.Chainladder(), cl.BornhuetterFerguson(), cl.Benktander(n_iters=2), cl.CapeCod() ] for model in list(itertools.product(dev, tail, ibnr)): print(model) cl.Pipeline( steps=[('dev', model[0]), ('tail', model[1]), ('ibnr', model[2])]).fit_predict( X, sample_weight=sample_weight).ibnr_.sum( 'origin').sum('columns').sum()
def test_basic_transform(raa): cl.Development().fit_transform(raa) cl.ClarkLDF().fit_transform(raa) cl.TailClark().fit_transform(raa) cl.TailBondy().fit_transform(raa) cl.TailConstant().fit_transform(raa) cl.TailCurve().fit_transform(raa) cl.BootstrapODPSample().fit_transform(raa) cl.IncrementalAdditive().fit_transform(raa, sample_weight=raa.latest_diagonal)
def test_basic_transform(): tri = cl.load_sample("raa") cl.Development().fit_transform(tri) cl.ClarkLDF().fit_transform(tri) cl.TailClark().fit_transform(tri) cl.TailBondy().fit_transform(tri) cl.TailConstant().fit_transform(tri) cl.TailCurve().fit_transform(tri) cl.BootstrapODPSample().fit_transform(tri) cl.IncrementalAdditive().fit_transform(tri, sample_weight=tri.latest_diagonal)