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
Copy file name to clipboardExpand all lines: chainladder/development/barnzehn.py
+30-4Lines changed: 30 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -22,18 +22,43 @@ class BarnettZehnwirth(TweedieGLM):
22
22
23
23
Parameters
24
24
----------
25
+
drop: tuple or list of tuples
26
+
Drops specific origin/development combination(s)
27
+
drop_valuation: str or list of str (default = None)
28
+
Drops specific valuation periods. str must be date convertible.
25
29
formula: formula-like
26
30
A patsy formula describing the independent variables, X of the GLM
31
+
feat_eng: dict
32
+
A dictionary with feature names as keys and a dictionary of function (with a key of 'func') and keyword arguments (with a key of 'kwargs')
33
+
(e.g. {
34
+
'feature_1':{
35
+
'func': function_name for feature 1,
36
+
'kwargs': keyword arguments for the function
37
+
},
38
+
'feature_2':{
39
+
'func': function_name for feature 2,
40
+
'kwargs': keyword arguments for the function
41
+
}
42
+
}
43
+
);
44
+
functions should be written with a input Dataframe named df; this is the DataFrame containing origin, development, and valuation that will passed into the function at run time
45
+
(e.g. this function adds 1 to every origin
46
+
def test_func(df)
47
+
return df['origin'] + 1
48
+
)
27
49
response: str
28
50
Column name for the reponse variable of the GLM. If ommitted, then the
Copy file name to clipboardExpand all lines: chainladder/development/learning.py
+56-10Lines changed: 56 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -33,6 +33,28 @@ class DevelopmentML(DevelopmentBase):
33
33
Time Series aspects of the model. Predictions from one development period
34
34
get used as featues in the next development period. Lags should be negative
35
35
integers.
36
+
drop: tuple or list of tuples
37
+
Drops specific origin/development combination(s)
38
+
drop_valuation: str or list of str (default = None)
39
+
Drops specific valuation periods. str must be date convertible.
40
+
feat_eng: dict
41
+
A dictionary with feature names as keys and a dictionary of function (with a key of 'func') and keyword arguments (with a key of 'kwargs')
42
+
(e.g. {
43
+
'feature_1':{
44
+
'func': function_name for feature 1,
45
+
'kwargs': keyword arguments for the function
46
+
},
47
+
'feature_2':{
48
+
'func': function_name for feature 2,
49
+
'kwargs': keyword arguments for the function
50
+
}
51
+
}
52
+
);
53
+
functions should be written with a input Dataframe named df; this is the DataFrame containing origin, development, and valuation that will passed into the function at run time
54
+
(e.g. this function adds 1 to every origin
55
+
def test_func(df)
56
+
return df['origin'] + 1
57
+
)
36
58
fit_incrementals:
37
59
Whether the response variable should be converted to an incremental basis
38
60
for fitting.
@@ -48,12 +70,16 @@ class DevelopmentML(DevelopmentBase):
this function tests the passing in a basic engineered feature. Since test_func just returns development, C(development) and C(teatfeat) should yield identical results
this function tests more complex feature engineering. Since origin_onehot just replicates the one-hot encoding that's performed inside sklearn LinearRegression, the two BZ models should yield identical results
0 commit comments