Ejemplo n.º 1
0
    def can_be_secondary_requirement(self, operation):
        models_repo = OperationTypesRepository()
        data_operations_repo = OperationTypesRepository(
            'data_operation_repository.json')

        operation_name = models_repo.operation_info_by_id(operation)
        if operation_name is None:
            operation_name = data_operations_repo.operation_info_by_id(
                operation)
        operation_tags = operation_name.tags

        secondary_model = True
        # TODO remove 'data_model'
        if 'data_model' in operation_tags:
            secondary_model = False
        return secondary_model
Ejemplo n.º 2
0
class DataOperation(Operation):
    """
    Class with fit/predict methods defining the evaluation strategy for the task

    :param operation_type: name of the data operation
    :param log: Log object to record messages
    """
    def __init__(self, operation_type: str, log: Log = None):
        super().__init__(operation_type, log)
        self.operations_repo = OperationTypesRepository('data_operation')

    @property
    def metadata(self) -> OperationMetaInfo:
        operation_info = self.operations_repo.operation_info_by_id(
            self.operation_type)
        if not operation_info:
            raise ValueError(f'Data operation {self.operation_type} not found')
        return operation_info
Ejemplo n.º 3
0
class Model(Operation):
    """
    Class with fit/predict methods defining the evaluation strategy for the task

    :param operation_type: name of the model
    :param log: Log object to record messages
    """
    def __init__(self, operation_type: str, log: Log = None):
        super().__init__(operation_type=operation_type, log=log)
        self.operations_repo = OperationTypesRepository(
            repository_name='model_repository.json')

    @property
    def metadata(self) -> OperationMetaInfo:
        model_info = self.operations_repo.operation_info_by_id(
            self.operation_type)
        if not model_info:
            raise ValueError(f'Model {self.operation_type} not found')
        return model_info