immuneML.workflows.instructions.ml_model_application package

Submodules

immuneML.workflows.instructions.ml_model_application.MLApplicationInstruction module

class immuneML.workflows.instructions.ml_model_application.MLApplicationInstruction.MLApplicationInstruction(dataset: immuneML.data_model.dataset.Dataset.Dataset, label_configuration: immuneML.environment.LabelConfiguration.LabelConfiguration, hp_setting: immuneML.hyperparameter_optimization.HPSetting.HPSetting, number_of_processes: int, name: str, store_encoded_data: bool)[source]

Bases: immuneML.workflows.instructions.Instruction.Instruction

Instruction which enables using trained ML models and encoders on new datasets which do not necessarily have labeled data.

The predictions are stored in the predictions.csv in the result path in the following format:

example_id

cmv

cmv_true_proba

cmv_false_proba

e1

True

0.8

0.2

e2

False

0.2

0.8

e3

True

0.78

0.22

Parameters
  • dataset – dataset for which examples need to be classified

  • config_path – path to the zip file exported from MLModelTraining instruction (which includes train ML model, encoder, preprocessing etc.)

  • number_of_processes (int) – number of processes to use for prediction

  • store_encoded_data (bool) – whether encoded dataset should be stored on disk; can be True or False; setting this argument to True might

  • the disk space usage (increase) –

Specification example for the MLApplication instruction:

instruction_name:
    type: MLApplication
    dataset: d1
    config_path: ./config.zip
    number_of_processes: 4
    store_encoded_data: False
run(result_path: pathlib.Path)[source]

immuneML.workflows.instructions.ml_model_application.MLApplicationState module

class immuneML.workflows.instructions.ml_model_application.MLApplicationState.MLApplicationState(dataset: immuneML.data_model.dataset.Dataset.Dataset, hp_setting: immuneML.hyperparameter_optimization.HPSetting.HPSetting, label_config: immuneML.environment.LabelConfiguration.LabelConfiguration, pool_size: int, name: str, store_encoded_data: bool, path: pathlib.Path = None, predictions_path: pathlib.Path = None)[source]

Bases: object

dataset: immuneML.data_model.dataset.Dataset.Dataset
hp_setting: immuneML.hyperparameter_optimization.HPSetting.HPSetting
label_config: immuneML.environment.LabelConfiguration.LabelConfiguration
name: str
path: pathlib.Path = None
pool_size: int
predictions_path: pathlib.Path = None
store_encoded_data: bool

Module contents