Spaces:
Sleeping
Sleeping
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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 233 |
ax.annotate(
|
| 234 |
-
f"
|
| 235 |
-
|
| 236 |
-
|
|
|
|
|
|
|
| 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=
|
| 258 |
-
min_samples_leaf=
|
| 259 |
-
min_samples_split=
|
| 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=
|
| 269 |
-
max_depth=
|
| 270 |
-
learning_rate=0.
|
| 271 |
-
subsample=0.
|
| 272 |
-
min_samples_leaf=
|
| 273 |
-
min_samples_split=
|
| 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=
|
| 309 |
-
max_depth=
|
| 310 |
-
learning_rate=0.
|
| 311 |
-
subsample=0.
|
| 312 |
-
colsample_bytree=0.
|
| 313 |
-
min_child_weight=
|
| 314 |
-
reg_alpha=0.
|
| 315 |
-
reg_lambda=
|
| 316 |
-
gamma=0.
|
| 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=
|
| 329 |
-
max_depth=
|
| 330 |
-
learning_rate=0.
|
| 331 |
-
num_leaves=
|
| 332 |
-
subsample=0.
|
| 333 |
-
colsample_bytree=0.
|
| 334 |
-
min_child_weight=
|
| 335 |
-
reg_alpha=0.
|
| 336 |
-
reg_lambda=
|
| 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,
|