31
31
public class Hyperparameters implements ToXContentObject {
32
32
33
33
public static final ParseField CLASS_ASSIGNMENT_OBJECTIVE = new ParseField ("class_assignment_objective" );
34
+ public static final ParseField ALPHA = new ParseField ("alpha" );
34
35
public static final ParseField DOWNSAMPLE_FACTOR = new ParseField ("downsample_factor" );
35
36
public static final ParseField ETA = new ParseField ("eta" );
36
37
public static final ParseField ETA_GROWTH_RATE_PER_TREE = new ParseField ("eta_growth_rate_per_tree" );
37
38
public static final ParseField FEATURE_BAG_FRACTION = new ParseField ("feature_bag_fraction" );
39
+ public static final ParseField GAMMA = new ParseField ("gamma" );
40
+ public static final ParseField LAMBDA = new ParseField ("lambda" );
38
41
public static final ParseField MAX_ATTEMPTS_TO_ADD_TREE = new ParseField ("max_attempts_to_add_tree" );
39
42
public static final ParseField MAX_OPTIMIZATION_ROUNDS_PER_HYPERPARAMETER = new ParseField (
40
43
"max_optimization_rounds_per_hyperparameter" );
41
44
public static final ParseField MAX_TREES = new ParseField ("max_trees" );
42
45
public static final ParseField NUM_FOLDS = new ParseField ("num_folds" );
43
46
public static final ParseField NUM_SPLITS_PER_FEATURE = new ParseField ("num_splits_per_feature" );
44
- public static final ParseField REGULARIZATION_DEPTH_PENALTY_MULTIPLIER = new ParseField ("regularization_depth_penalty_multiplier" );
45
- public static final ParseField REGULARIZATION_LEAF_WEIGHT_PENALTY_MULTIPLIER
46
- = new ParseField ("regularization_leaf_weight_penalty_multiplier" );
47
- public static final ParseField REGULARIZATION_SOFT_TREE_DEPTH_LIMIT = new ParseField ("regularization_soft_tree_depth_limit" );
48
- public static final ParseField REGULARIZATION_SOFT_TREE_DEPTH_TOLERANCE = new ParseField ("regularization_soft_tree_depth_tolerance" );
49
- public static final ParseField REGULARIZATION_TREE_SIZE_PENALTY_MULTIPLIER =
50
- new ParseField ("regularization_tree_size_penalty_multiplier" );
47
+ public static final ParseField SOFT_TREE_DEPTH_LIMIT = new ParseField ("soft_tree_depth_limit" );
48
+ public static final ParseField SOFT_TREE_DEPTH_TOLERANCE = new ParseField ("soft_tree_depth_tolerance" );
51
49
52
50
public static ConstructingObjectParser <Hyperparameters , Void > PARSER = new ConstructingObjectParser <>("classification_hyperparameters" ,
53
51
true ,
@@ -57,88 +55,92 @@ public class Hyperparameters implements ToXContentObject {
57
55
(Double ) a [2 ],
58
56
(Double ) a [3 ],
59
57
(Double ) a [4 ],
60
- (Integer ) a [5 ],
61
- (Integer ) a [6 ],
62
- (Integer ) a [7 ],
58
+ (Double ) a [5 ],
59
+ (Double ) a [6 ],
60
+ (Double ) a [7 ],
63
61
(Integer ) a [8 ],
64
62
(Integer ) a [9 ],
65
- (Double ) a [10 ],
66
- (Double ) a [11 ],
67
- (Double ) a [12 ],
63
+ (Integer ) a [10 ],
64
+ (Integer ) a [11 ],
65
+ (Integer ) a [12 ],
68
66
(Double ) a [13 ],
69
67
(Double ) a [14 ]
70
68
));
71
69
72
70
static {
73
71
PARSER .declareString (optionalConstructorArg (), CLASS_ASSIGNMENT_OBJECTIVE );
72
+ PARSER .declareDouble (optionalConstructorArg (), ALPHA );
74
73
PARSER .declareDouble (optionalConstructorArg (), DOWNSAMPLE_FACTOR );
75
74
PARSER .declareDouble (optionalConstructorArg (), ETA );
76
75
PARSER .declareDouble (optionalConstructorArg (), ETA_GROWTH_RATE_PER_TREE );
77
76
PARSER .declareDouble (optionalConstructorArg (), FEATURE_BAG_FRACTION );
77
+ PARSER .declareDouble (optionalConstructorArg (), GAMMA );
78
+ PARSER .declareDouble (optionalConstructorArg (), LAMBDA );
78
79
PARSER .declareInt (optionalConstructorArg (), MAX_ATTEMPTS_TO_ADD_TREE );
79
80
PARSER .declareInt (optionalConstructorArg (), MAX_OPTIMIZATION_ROUNDS_PER_HYPERPARAMETER );
80
81
PARSER .declareInt (optionalConstructorArg (), MAX_TREES );
81
82
PARSER .declareInt (optionalConstructorArg (), NUM_FOLDS );
82
83
PARSER .declareInt (optionalConstructorArg (), NUM_SPLITS_PER_FEATURE );
83
- PARSER .declareDouble (optionalConstructorArg (), REGULARIZATION_DEPTH_PENALTY_MULTIPLIER );
84
- PARSER .declareDouble (optionalConstructorArg (), REGULARIZATION_LEAF_WEIGHT_PENALTY_MULTIPLIER );
85
- PARSER .declareDouble (optionalConstructorArg (), REGULARIZATION_SOFT_TREE_DEPTH_LIMIT );
86
- PARSER .declareDouble (optionalConstructorArg (), REGULARIZATION_SOFT_TREE_DEPTH_TOLERANCE );
87
- PARSER .declareDouble (optionalConstructorArg (), REGULARIZATION_TREE_SIZE_PENALTY_MULTIPLIER );
84
+ PARSER .declareDouble (optionalConstructorArg (), SOFT_TREE_DEPTH_LIMIT );
85
+ PARSER .declareDouble (optionalConstructorArg (), SOFT_TREE_DEPTH_TOLERANCE );
88
86
}
89
87
90
88
private final String classAssignmentObjective ;
89
+ private final Double alpha ;
91
90
private final Double downsampleFactor ;
92
91
private final Double eta ;
93
92
private final Double etaGrowthRatePerTree ;
94
93
private final Double featureBagFraction ;
94
+ private final Double gamma ;
95
+ private final Double lambda ;
95
96
private final Integer maxAttemptsToAddTree ;
96
97
private final Integer maxOptimizationRoundsPerHyperparameter ;
97
98
private final Integer maxTrees ;
98
99
private final Integer numFolds ;
99
100
private final Integer numSplitsPerFeature ;
100
- private final Double regularizationDepthPenaltyMultiplier ;
101
- private final Double regularizationLeafWeightPenaltyMultiplier ;
102
- private final Double regularizationSoftTreeDepthLimit ;
103
- private final Double regularizationSoftTreeDepthTolerance ;
104
- private final Double regularizationTreeSizePenaltyMultiplier ;
101
+ private final Double softTreeDepthLimit ;
102
+ private final Double softTreeDepthTolerance ;
105
103
106
104
public Hyperparameters (String classAssignmentObjective ,
105
+ Double alpha ,
107
106
Double downsampleFactor ,
108
107
Double eta ,
109
108
Double etaGrowthRatePerTree ,
110
109
Double featureBagFraction ,
110
+ Double gamma ,
111
+ Double lambda ,
111
112
Integer maxAttemptsToAddTree ,
112
113
Integer maxOptimizationRoundsPerHyperparameter ,
113
114
Integer maxTrees ,
114
115
Integer numFolds ,
115
116
Integer numSplitsPerFeature ,
116
- Double regularizationDepthPenaltyMultiplier ,
117
- Double regularizationLeafWeightPenaltyMultiplier ,
118
- Double regularizationSoftTreeDepthLimit ,
119
- Double regularizationSoftTreeDepthTolerance ,
120
- Double regularizationTreeSizePenaltyMultiplier ) {
117
+ Double softTreeDepthLimit ,
118
+ Double softTreeDepthTolerance ) {
121
119
this .classAssignmentObjective = classAssignmentObjective ;
120
+ this .alpha = alpha ;
122
121
this .downsampleFactor = downsampleFactor ;
123
122
this .eta = eta ;
124
123
this .etaGrowthRatePerTree = etaGrowthRatePerTree ;
125
124
this .featureBagFraction = featureBagFraction ;
125
+ this .gamma = gamma ;
126
+ this .lambda = lambda ;
126
127
this .maxAttemptsToAddTree = maxAttemptsToAddTree ;
127
128
this .maxOptimizationRoundsPerHyperparameter = maxOptimizationRoundsPerHyperparameter ;
128
129
this .maxTrees = maxTrees ;
129
130
this .numFolds = numFolds ;
130
131
this .numSplitsPerFeature = numSplitsPerFeature ;
131
- this .regularizationDepthPenaltyMultiplier = regularizationDepthPenaltyMultiplier ;
132
- this .regularizationLeafWeightPenaltyMultiplier = regularizationLeafWeightPenaltyMultiplier ;
133
- this .regularizationSoftTreeDepthLimit = regularizationSoftTreeDepthLimit ;
134
- this .regularizationSoftTreeDepthTolerance = regularizationSoftTreeDepthTolerance ;
135
- this .regularizationTreeSizePenaltyMultiplier = regularizationTreeSizePenaltyMultiplier ;
132
+ this .softTreeDepthLimit = softTreeDepthLimit ;
133
+ this .softTreeDepthTolerance = softTreeDepthTolerance ;
136
134
}
137
135
138
136
public String getClassAssignmentObjective () {
139
137
return classAssignmentObjective ;
140
138
}
141
139
140
+ public Double getAlpha () {
141
+ return alpha ;
142
+ }
143
+
142
144
public Double getDownsampleFactor () {
143
145
return downsampleFactor ;
144
146
}
@@ -155,6 +157,14 @@ public Double getFeatureBagFraction() {
155
157
return featureBagFraction ;
156
158
}
157
159
160
+ public Double getGamma () {
161
+ return gamma ;
162
+ }
163
+
164
+ public Double getLambda () {
165
+ return lambda ;
166
+ }
167
+
158
168
public Integer getMaxAttemptsToAddTree () {
159
169
return maxAttemptsToAddTree ;
160
170
}
@@ -175,24 +185,12 @@ public Integer getNumSplitsPerFeature() {
175
185
return numSplitsPerFeature ;
176
186
}
177
187
178
- public Double getRegularizationDepthPenaltyMultiplier () {
179
- return regularizationDepthPenaltyMultiplier ;
180
- }
181
-
182
- public Double getRegularizationLeafWeightPenaltyMultiplier () {
183
- return regularizationLeafWeightPenaltyMultiplier ;
184
- }
185
-
186
- public Double getRegularizationSoftTreeDepthLimit () {
187
- return regularizationSoftTreeDepthLimit ;
188
- }
189
-
190
- public Double getRegularizationSoftTreeDepthTolerance () {
191
- return regularizationSoftTreeDepthTolerance ;
188
+ public Double getSoftTreeDepthLimit () {
189
+ return softTreeDepthLimit ;
192
190
}
193
191
194
- public Double getRegularizationTreeSizePenaltyMultiplier () {
195
- return regularizationTreeSizePenaltyMultiplier ;
192
+ public Double getSoftTreeDepthTolerance () {
193
+ return softTreeDepthTolerance ;
196
194
}
197
195
198
196
@ Override
@@ -201,6 +199,9 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
201
199
if (classAssignmentObjective != null ) {
202
200
builder .field (CLASS_ASSIGNMENT_OBJECTIVE .getPreferredName (), classAssignmentObjective );
203
201
}
202
+ if (alpha != null ) {
203
+ builder .field (ALPHA .getPreferredName (), alpha );
204
+ }
204
205
if (downsampleFactor != null ) {
205
206
builder .field (DOWNSAMPLE_FACTOR .getPreferredName (), downsampleFactor );
206
207
}
@@ -213,6 +214,12 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
213
214
if (featureBagFraction != null ) {
214
215
builder .field (FEATURE_BAG_FRACTION .getPreferredName (), featureBagFraction );
215
216
}
217
+ if (gamma != null ) {
218
+ builder .field (GAMMA .getPreferredName (), gamma );
219
+ }
220
+ if (lambda != null ) {
221
+ builder .field (LAMBDA .getPreferredName (), lambda );
222
+ }
216
223
if (maxAttemptsToAddTree != null ) {
217
224
builder .field (MAX_ATTEMPTS_TO_ADD_TREE .getPreferredName (), maxAttemptsToAddTree );
218
225
}
@@ -228,20 +235,11 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
228
235
if (numSplitsPerFeature != null ) {
229
236
builder .field (NUM_SPLITS_PER_FEATURE .getPreferredName (), numSplitsPerFeature );
230
237
}
231
- if (regularizationDepthPenaltyMultiplier != null ) {
232
- builder .field (REGULARIZATION_DEPTH_PENALTY_MULTIPLIER .getPreferredName (), regularizationDepthPenaltyMultiplier );
233
- }
234
- if (regularizationLeafWeightPenaltyMultiplier != null ) {
235
- builder .field (REGULARIZATION_LEAF_WEIGHT_PENALTY_MULTIPLIER .getPreferredName (), regularizationLeafWeightPenaltyMultiplier );
236
- }
237
- if (regularizationSoftTreeDepthLimit != null ) {
238
- builder .field (REGULARIZATION_SOFT_TREE_DEPTH_LIMIT .getPreferredName (), regularizationSoftTreeDepthLimit );
239
- }
240
- if (regularizationSoftTreeDepthTolerance != null ) {
241
- builder .field (REGULARIZATION_SOFT_TREE_DEPTH_TOLERANCE .getPreferredName (), regularizationSoftTreeDepthTolerance );
238
+ if (softTreeDepthLimit != null ) {
239
+ builder .field (SOFT_TREE_DEPTH_LIMIT .getPreferredName (), softTreeDepthLimit );
242
240
}
243
- if (regularizationTreeSizePenaltyMultiplier != null ) {
244
- builder .field (REGULARIZATION_TREE_SIZE_PENALTY_MULTIPLIER .getPreferredName (), regularizationTreeSizePenaltyMultiplier );
241
+ if (softTreeDepthTolerance != null ) {
242
+ builder .field (SOFT_TREE_DEPTH_TOLERANCE .getPreferredName (), softTreeDepthTolerance );
245
243
}
246
244
builder .endObject ();
247
245
return builder ;
@@ -254,40 +252,40 @@ public boolean equals(Object o) {
254
252
255
253
Hyperparameters that = (Hyperparameters ) o ;
256
254
return Objects .equals (classAssignmentObjective , that .classAssignmentObjective )
255
+ && Objects .equals (alpha , that .alpha )
257
256
&& Objects .equals (downsampleFactor , that .downsampleFactor )
258
257
&& Objects .equals (eta , that .eta )
259
258
&& Objects .equals (etaGrowthRatePerTree , that .etaGrowthRatePerTree )
260
259
&& Objects .equals (featureBagFraction , that .featureBagFraction )
260
+ && Objects .equals (gamma , that .gamma )
261
+ && Objects .equals (lambda , that .lambda )
261
262
&& Objects .equals (maxAttemptsToAddTree , that .maxAttemptsToAddTree )
262
263
&& Objects .equals (maxOptimizationRoundsPerHyperparameter , that .maxOptimizationRoundsPerHyperparameter )
263
264
&& Objects .equals (maxTrees , that .maxTrees )
264
265
&& Objects .equals (numFolds , that .numFolds )
265
266
&& Objects .equals (numSplitsPerFeature , that .numSplitsPerFeature )
266
- && Objects .equals (regularizationDepthPenaltyMultiplier , that .regularizationDepthPenaltyMultiplier )
267
- && Objects .equals (regularizationLeafWeightPenaltyMultiplier , that .regularizationLeafWeightPenaltyMultiplier )
268
- && Objects .equals (regularizationSoftTreeDepthLimit , that .regularizationSoftTreeDepthLimit )
269
- && Objects .equals (regularizationSoftTreeDepthTolerance , that .regularizationSoftTreeDepthTolerance )
270
- && Objects .equals (regularizationTreeSizePenaltyMultiplier , that .regularizationTreeSizePenaltyMultiplier );
267
+ && Objects .equals (softTreeDepthLimit , that .softTreeDepthLimit )
268
+ && Objects .equals (softTreeDepthTolerance , that .softTreeDepthTolerance );
271
269
}
272
270
273
271
@ Override
274
272
public int hashCode () {
275
273
return Objects .hash (
276
274
classAssignmentObjective ,
275
+ alpha ,
277
276
downsampleFactor ,
278
277
eta ,
279
278
etaGrowthRatePerTree ,
280
279
featureBagFraction ,
280
+ gamma ,
281
+ lambda ,
281
282
maxAttemptsToAddTree ,
282
283
maxOptimizationRoundsPerHyperparameter ,
283
284
maxTrees ,
284
285
numFolds ,
285
286
numSplitsPerFeature ,
286
- regularizationDepthPenaltyMultiplier ,
287
- regularizationLeafWeightPenaltyMultiplier ,
288
- regularizationSoftTreeDepthLimit ,
289
- regularizationSoftTreeDepthTolerance ,
290
- regularizationTreeSizePenaltyMultiplier
287
+ softTreeDepthLimit ,
288
+ softTreeDepthTolerance
291
289
);
292
290
}
293
291
}
0 commit comments