You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Split out of #1265 at @henrydingliu's request. No bug here, this is the design question that issue kept running into.
There are two ways to say "fit by line of business, apply per company":
# A: the parametercl.CapeCod(groupby="LOB").fit(tri, sample_weight=prem)
# B: aggregate the training data and let predict() work out what happenedmodel=cl.CapeCod().fit(
tri.groupby("LOB").sum(), sample_weight=prem.groupby("LOB").sum())
model.predict(tri, sample_weight=prem)
B works by diffing key_labels between sample_weight and apriori_ and regrouping if they differ (capecod.py:325). That inference is where the #1265 bug lived.
The two routes agree, once development is grouped consistently (clrd, comauto):
route
apriori
A, Development() ungrouped
0.5602627308
A, Development(groupby="LOB")
0.5689995797
B
0.5689995797
One correction to what I wrote in #1265: I presented A and B as giving different aprioris. The difference is entirely the development grain, not the CapeCod grain.
So: with groupby available and giving the identical answer, does predict() need to infer the grain at all? As I see it:
Keep it, document that A and B are equivalent, and warn when the inference fires.
Deprecate the inference in favour of groupby.
I lean 2. The inference is convenient, but it currently happens invisibly: a user who calls predict() on a 775-company triangle gets a 6-row apriori_ back and nothing says why. A warning turns a silent regrouping into a visible one.
Split out of #1265 at @henrydingliu's request. No bug here, this is the design question that issue kept running into.
There are two ways to say "fit by line of business, apply per company":
B works by diffing
key_labelsbetweensample_weightandapriori_and regrouping if they differ (capecod.py:325). That inference is where the #1265 bug lived.The two routes agree, once development is grouped consistently (
clrd, comauto):Development()ungroupedDevelopment(groupby="LOB")One correction to what I wrote in #1265: I presented A and B as giving different aprioris. The difference is entirely the development grain, not the CapeCod grain.
So: with
groupbyavailable and giving the identical answer, doespredict()need to infer the grain at all? As I see it:groupby.I lean 2. The inference is convenient, but it currently happens invisibly: a user who calls
predict()on a 775-company triangle gets a 6-rowapriori_back and nothing says why. A warning turns a silent regrouping into a visible one.I can implement whichever you prefer.