[docs]classSubsamplingInstruction(Instruction):""" Subsampling is an instruction that subsamples a given dataset and creates multiple smaller dataset according to the parameters provided. **Specification arguments:** - dataset (str): original dataset which will be used as a basis for subsampling - subsampled_dataset_sizes (list): a list of dataset sizes (number of examples) each subsampled dataset should have - dataset_export_formats (list): in which formats to export the subsampled datasets. Valid formats are class names of any non-abstract class inheriting :py:obj:`~immuneML.IO.dataset_export.DataExporter.DataExporter`. **YAML specification:** .. indent with spaces .. code-block:: yaml instructions: my_subsampling_instruction: # user-defined name of the instruction type: Subsampling # which instruction to execute dataset: my_dataset # original dataset to be subsampled, with e.g., 300 examples subsampled_dataset_sizes: # how large the subsampled datasets should be, one dataset will be created for each list item - 200 # one subsampled dataset with 200 examples (200 repertoires if my_dataset was repertoire dataset) - 100 # the other subsampled dataset will have 100 examples dataset_export_formats: # in which formats to export the subsampled datasets - ImmuneML - AIRR """def__init__(self,dataset:Dataset,subsampled_dataset_sizes:List[int],dataset_export_formats:list,result_path:Path=None,name:str=None):self.state=SubsamplingState(dataset,subsampled_dataset_sizes,dataset_export_formats,result_path,name)
[docs]@staticmethoddefget_documentation():doc=str(SubsamplingInstruction.__doc__)valid_strategy_values=ReflectionHandler.all_nonabstract_subclass_basic_names(DataExporter,"Exporter","dataset_export/")valid_strategy_values=str(valid_strategy_values)[1:-1].replace("'","`")mapping={"Valid formats are class names of any non-abstract class inheriting "":py:obj:`~immuneML.IO.dataset_export.DataExporter.DataExporter`.":f"Valid values are: {valid_strategy_values}."}doc=update_docs_per_mapping(doc,mapping)returndoc