peal.entrypoints.train_distilled_predictor¶
Distil a trained predictor into a smoother surrogate for counterfactuals.
Drives distill_predictor in peal/training/trainers.py: the predictor
of --config_predictor is loaded together with its training and
validation dataloaders, and a second network described by
--config_distilled_predictor is fitted to mimic it with
leakysoftplus activations in place of ReLU, so that gradients through it
are informative. The explainers perform the same step on the fly (the
distilled_predictor field of the explainer config); this script runs it
in isolation.
Invocation:
python train_distilled_predictor.py --config_predictor <predictor.yaml> \
--config_distilled_predictor <distilled_predictor.yaml>
Both arguments are required, so the sys.argv[-1] fallback and the
commented-out ModelTrainer block are dead code. A <PEAL_BASE> prefix
in the distilled config’s model_path is resolved to the project
directory; the distilled model (model.cpl and config.yaml) is written
there.
Functions
Load both predictor configs and distil the first into the second. |