Model performance overview
5-fold stratified cross-validation results. Balanced accuracy accounts for class imbalance; macro-F1 weights all three classes equally regardless of frequency.
Accuracy is inflated by class dominance (fresh ≫ brackish/saline). Balanced accuracy and macro-F1 are the reliable metrics here.
Confusion matrix
Aggregated across all 5 CV folds. Rows = true class, columns = predicted class. Off-diagonal cells are misclassifications.
Feature importance
Two complementary methods. MDI (Mean Decrease Impurity) from the full-dataset Random Forest. Permutation importance measures the drop in balanced accuracy when each feature is randomly shuffled on a held-out split — more reliable for high-cardinality features.
Per-class metrics
Precision, recall and F1-score for each salinity class across both models. Aggregated from 5 CV folds.
Methodology
Design decisions and scientific rationale for the ML pipeline.
| Lag windows | 7d · 30d · 90d · 180d |
| Precip / PET / ET0 | sum over window |
| Temp · humidity · wind · radiation | mean over window |
| Soil moisture (4 depths) | mean over window |
| Soil temperature (4 depths) | mean over window |
| Water balance (P − PET) | sum over window |
| Static features | distance_coast_m · depth · doy · year · month |
| Total features | 85 |
| Fresh | < 250 mg/L |
| Brackish | 250 – 1000 mg/L |
| Saline | > 1000 mg/L |
| RF n_estimators | 200 (CV) · 500 (importance) |
| RF class_weight | balanced |
| GB n_estimators | 200 |
| GB max_depth | 4 |
| GB learning_rate | 0.05 |
| GB imbalance | sample_weight (balanced) |
| CV strategy | StratifiedKFold · 5 folds |