def mlobject_from_dict(schema_type, schema_version, dict_value): ml_object = MLObject() ml_object.set_type( schema_version=schema_version, schema_type=schema_type, ) dict_value['schema_type'] = schema_type dict_value['schema_version'] = schema_version MLObject.update_tree(ml_object, dict_value) errors = ml_object.validate() if errors: return None, errors else: return ml_object, None
def execute(self, result_object_schema_type, result_object_schema_version): # Create Result object results_object = MLObject() results_object.set_type( schema_type=result_object_schema_type, schema_version=result_object_schema_version, ) # Mocked up results return_dict = { "data_output_path": str(Path("tests/data/data_output.csv")), "data_statistics_path": str(Path("tests/data/data_stats.csv")), "data_schemas_path": str(Path("tests/data/data_schemas.yaml")), "feature_file_path": str(Path("tests/data/feature_file.yaml")), } results_object.data_output_path = return_dict["data_output_path"] results_object.data_statistics_path = return_dict[ "data_statistics_path"] results_object.data_schemas_path = return_dict["data_schemas_path"] results_object.feature_file_path = return_dict["feature_file_path"] _ = results_object.validate() # noqa return results_object
def execute(self, result_object_schema_type, result_object_schema_version): # Create Result object results_object = MLObject() results_object.set_type( schema_type=result_object_schema_type, schema_version=result_object_schema_version, ) # Mocked up results return_dict = { "training_execution_id": str(uuid.uuid4()), "accuracy": float(random.randrange(0, 100) / 100), "global_step": 10**random.randrange(2, 4), "loss": float(random.randrange(1000, 9999) / 1000), } results_object.training_execution_id = return_dict[ "training_execution_id"] results_object.accuracy = return_dict["accuracy"] results_object.global_step = return_dict["global_step"] results_object.loss = return_dict["loss"] errors = results_object.validate() # noqa return results_object