Rthur2003 commited on
Commit
0d5b4e8
·
1 Parent(s): 1c2de42

feat: optimize Gradient Boosting and XGBoost parameters for improved model performance

Browse files
Files changed (1) hide show
  1. app/training/train_classifier.py +23 -21
app/training/train_classifier.py CHANGED
@@ -265,10 +265,12 @@ def _build_candidates() -> list[tuple[str, Any]]:
265
  (
266
  "Gradient Boosting",
267
  GradientBoostingClassifier(
268
- n_estimators=200,
269
- max_depth=6,
270
  learning_rate=0.1,
271
- subsample=0.8,
 
 
272
  random_state=42,
273
  ),
274
  ),
@@ -303,15 +305,15 @@ def _build_candidates() -> list[tuple[str, Any]]:
303
  candidates.append((
304
  "XGBoost",
305
  xgb.XGBClassifier(
306
- n_estimators=200,
307
- max_depth=5,
308
- learning_rate=0.05,
309
- subsample=0.8,
310
- colsample_bytree=0.8,
311
- min_child_weight=5,
312
- reg_alpha=0.1,
313
- reg_lambda=1.0,
314
- gamma=0.1,
315
  scale_pos_weight=1.0,
316
  eval_metric="logloss",
317
  random_state=42,
@@ -323,15 +325,15 @@ def _build_candidates() -> list[tuple[str, Any]]:
323
  candidates.append((
324
  "LightGBM",
325
  lgb.LGBMClassifier(
326
- n_estimators=200,
327
- max_depth=5,
328
- learning_rate=0.05,
329
- num_leaves=24,
330
- subsample=0.8,
331
- colsample_bytree=0.8,
332
- min_child_weight=5,
333
- reg_alpha=0.1,
334
- reg_lambda=1.0,
335
  class_weight="balanced",
336
  random_state=42,
337
  verbose=-1,
 
265
  (
266
  "Gradient Boosting",
267
  GradientBoostingClassifier(
268
+ n_estimators=150,
269
+ max_depth=3,
270
  learning_rate=0.1,
271
+ subsample=0.7,
272
+ min_samples_leaf=20,
273
+ min_samples_split=30,
274
  random_state=42,
275
  ),
276
  ),
 
305
  candidates.append((
306
  "XGBoost",
307
  xgb.XGBClassifier(
308
+ n_estimators=150,
309
+ max_depth=3,
310
+ learning_rate=0.1,
311
+ subsample=0.7,
312
+ colsample_bytree=0.7,
313
+ min_child_weight=10,
314
+ reg_alpha=0.5,
315
+ reg_lambda=2.0,
316
+ gamma=0.3,
317
  scale_pos_weight=1.0,
318
  eval_metric="logloss",
319
  random_state=42,
 
325
  candidates.append((
326
  "LightGBM",
327
  lgb.LGBMClassifier(
328
+ n_estimators=150,
329
+ max_depth=3,
330
+ learning_rate=0.1,
331
+ num_leaves=8,
332
+ subsample=0.7,
333
+ colsample_bytree=0.7,
334
+ min_child_weight=10,
335
+ reg_alpha=0.5,
336
+ reg_lambda=2.0,
337
  class_weight="balanced",
338
  random_state=42,
339
  verbose=-1,