[docs]classPredefinedWeighting(ExampleWeightingStrategy):''' Example weighting strategy where weights are supplied in a file. **Specification arguments:** - file_path (Path): Path to the example weights, should contain the columns 'identifier' and 'example_weight': ========== ============== identifier example_weight ========== ============== 1 0.5 2 1 3 1 ======== ============== - separator (str): Column separator in the input file. '''def__init__(self,file_path,separator,name:str=None):super().__init__(name)self.file_path=Path(file_path)self.separator=separator@staticmethoddef_prepare_parameters(file_path,separator,name:str=None):file_path=Path(file_path)ifnotfile_path.is_file():raiseFileNotFoundError(f"{PredefinedWeighting.__class__.__name__}: example weigths could not be loaded from {file_path}. "f"Check if the path to the file is properly set.")ParameterValidator.assert_type_and_value(separator,str,location=PredefinedWeighting.__name__,parameter_name="separator")return{"file_path":file_path,"separator":separator,"name":name}