peal.training.trainers.distill_binary_dataset

peal.training.trainers.distill_binary_dataset(predictor_distillation, base_path, predictor, predictor_datasets)[source]

Relabel Image2MixedDataset-style datasets with a predictor’s outputs.

For every dataset i the predictions are written once to <base_path>/<i>predictions.csv via get_predictions; a copy of the dataset config with confounder information removed and output_type="multiclass" is then loaded from that csv. The first dataset becomes the train split, all others validation splits.

Parameters:
  • predictor_distillation (str, dict or PredictorConfig) – Config of the student; its task is attached to the new datasets.

  • base_path (str) – Directory the prediction csv files are written to.

  • predictor (torch.nn.Module) – Teacher that produces the labels.

  • predictor_datasets (list) – Datasets or dataloaders to relabel.

Returns:

One relabelled dataset per input dataset.

Return type:

list