Rthur2003 commited on
Commit
e68824c
·
1 Parent(s): 905436c

feat: update model parameters for Random Forest, Gradient Boosting, XGBoost, and LightGBM to enhance performance

Browse files
app/training/generate_deep_figures.py CHANGED
@@ -229,11 +229,18 @@ def fig_learning_curve(model, scaler, X, y):
229
  fontsize=13, fontweight="bold")
230
  ax.legend(loc="lower right", framealpha=0.85)
231
  gap = tr_mean[-1] - val_mean[-1]
232
- diagnosis = "düşük varyans (iyi)" if gap < 0.03 else "overfitting işareti"
 
 
 
 
 
233
  ax.annotate(
234
- f"Son gap: {gap:.4f}\n→ {diagnosis}",
235
- xy=(0.55, 0.05), xycoords="axes fraction",
236
- fontsize=10,
 
 
237
  bbox=dict(boxstyle="round,pad=0.5", facecolor=PALETTE["bg"],
238
  edgecolor=PALETTE["primary"], alpha=0.85),
239
  )
 
229
  fontsize=13, fontweight="bold")
230
  ax.legend(loc="lower right", framealpha=0.85)
231
  gap = tr_mean[-1] - val_mean[-1]
232
+ if gap > 0.05:
233
+ diagnosis = "yüksek varyans — regularizasyon gerekli"
234
+ elif gap > 0.03:
235
+ diagnosis = "orta varyans — kabul edilebilir"
236
+ else:
237
+ diagnosis = "düşük varyans (iyi)"
238
  ax.annotate(
239
+ f"Train-Val Gap: {gap:.4f}\n→ {diagnosis}\n"
240
+ f"Not: Tree ensemble train score\n"
241
+ f"yapısal olarak ~1.0 olur",
242
+ xy=(0.42, 0.05), xycoords="axes fraction",
243
+ fontsize=9,
244
  bbox=dict(boxstyle="round,pad=0.5", facecolor=PALETTE["bg"],
245
  edgecolor=PALETTE["primary"], alpha=0.85),
246
  )
app/training/train_classifier.py CHANGED
@@ -254,9 +254,9 @@ def _build_candidates() -> list[tuple[str, Any]]:
254
  "Random Forest",
255
  RandomForestClassifier(
256
  n_estimators=200,
257
- max_depth=8,
258
- min_samples_leaf=15,
259
- min_samples_split=20,
260
  class_weight="balanced",
261
  random_state=42,
262
  n_jobs=-1,
@@ -265,12 +265,12 @@ def _build_candidates() -> list[tuple[str, Any]]:
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,15 +305,15 @@ def _build_candidates() -> list[tuple[str, Any]]:
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,15 +325,15 @@ def _build_candidates() -> list[tuple[str, Any]]:
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,
 
254
  "Random Forest",
255
  RandomForestClassifier(
256
  n_estimators=200,
257
+ max_depth=10,
258
+ min_samples_leaf=10,
259
+ min_samples_split=15,
260
  class_weight="balanced",
261
  random_state=42,
262
  n_jobs=-1,
 
265
  (
266
  "Gradient Boosting",
267
  GradientBoostingClassifier(
268
+ n_estimators=200,
269
+ max_depth=4,
270
+ learning_rate=0.08,
271
+ subsample=0.75,
272
+ min_samples_leaf=12,
273
+ min_samples_split=20,
274
  random_state=42,
275
  ),
276
  ),
 
305
  candidates.append((
306
  "XGBoost",
307
  xgb.XGBClassifier(
308
+ n_estimators=200,
309
+ max_depth=4,
310
+ learning_rate=0.08,
311
+ subsample=0.75,
312
+ colsample_bytree=0.75,
313
+ min_child_weight=8,
314
+ reg_alpha=0.3,
315
+ reg_lambda=1.5,
316
+ gamma=0.2,
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=200,
329
+ max_depth=4,
330
+ learning_rate=0.08,
331
+ num_leaves=12,
332
+ subsample=0.75,
333
+ colsample_bytree=0.75,
334
+ min_child_weight=8,
335
+ reg_alpha=0.3,
336
+ reg_lambda=1.5,
337
  class_weight="balanced",
338
  random_state=42,
339
  verbose=-1,