eugene.evaluate.predictions

eugene.evaluate.predictions(model, dataloader, gpus=None, out_dir=None, name=None, version='', file_label='')

Predictions from a model and dataloader.

Simple wrapper around pytorch_lightning.Trainer.predict() that returns a pandas dataframe. Makes use of a custom callback, PredictionWriter, to write predictions to disk if the out_dir argument is provided.

Parameters:
  • model (LightningModule) – Model to predict with.

  • dataloader (DataLoader) – Dataloader to predict with.

  • gpus (int, optional) – Number of GPUs to use. If None, uses settings.gpus.

  • out_dir (os.PathLike, optional) – Directory to write predictions to. If None, does not write predictions to disk.

  • name (str, optional) – Name of the model. If None, uses model.model_name.

  • version (str, optional) – Version of the model. If None, uses “”.

  • file_label (str, optional) – Label to add to the file name. If None, uses “”.

Returns:

preds – Predictions from the model and dataloader.

Return type:

pd.DataFrame