Out-of-fold explainability
Current mllabiome explainability is out-of-fold by default. This is the recommended mechanism for nested-CV and LODO experiments.
Principle
Every explained row is explained using a model that was not fitted on that row.
For MPMA-B, Baseline RF, and specific MPMA targets:
outer train → fit transformation → fit learner
outer test → transform with the train-fitted transformation → explainFor MPMA-E:
for each outer fold:
fit each selected member on outer train
predict/explain outer test
aggregate member predictions with the selected ensemble ruleMethods
By default, the configured target is explained using:
| Method | OOF behavior |
|---|---|
| SHAP | Background from the outer-training fold; explained rows from the outer-test fold |
| LIME | Explainer fitted on outer-training transformed data; local explanations for outer-test rows |
| Permutation importance | Computed on the outer-test fold with y_test |
| ALE | Fold-fitted model and outer-test matrix; sparse features that are constant in a fold are skipped for that fold only |
| Interactions | Two-dimensional ALE interaction analysis, aggregated across folds |
The package does not silently replace a requested method with another method. If a dependency is missing or the selected target cannot be explained, the explainability stage fails. Sparse ALE features are not a fallback case: they are recorded as not estimable for the affected fold and reported in diagnostics.
Target selection
EXPLAINABILITY = mll.Explainability(targets="auto", top_k=30)targets="auto" runs:
MPMA-E, when selected_unit.json exists
MPMA-B
strict Baseline RF, when the required baseline existsSpecific target examples:
# Best individual MPMA only
EXPLAINABILITY = mll.Explainability(targets=("mpma_b",), top_k=30)
# Selected ensemble only
EXPLAINABILITY = mll.Explainability(targets=("mpma_e",), top_k=30)
# Strict baseline RF only
EXPLAINABILITY = mll.Explainability(targets=("baseline_rf",), top_k=30)
# Specific config ID
EXPLAINABILITY = mll.Explainability(targets=("48e21e491927",), top_k=30)Important output files
| File | Meaning |
|---|---|
feature_importance.tsv | Consensus importance table across configured methods |
feature_importance_<method>.tsv | Method-specific importance table |
oof_predictions.tsv | Out-of-fold predictions used by explainability |
explained_unit.json | Metadata for the explained target, including OOF status |
ale_skipped_features.tsv | Sparse features/folds where ALE was not estimable, if any |
feature_interactions_by_target_all_methods.csv | Interaction summary by target and method |
Last updated on