Source code for synicix_ml_pipeline.datajoint_tables.TrainingTask

import datajoint as dj
import os
import json
import hashlib

from synicix_ml_pipeline.datajoint_tables.BaseTable import schema
from synicix_ml_pipeline.datajoint_tables.BaseTable import BaseTable
from synicix_ml_pipeline.datajoint_tables.ModelConfig import ModelConfig
from synicix_ml_pipeline.datajoint_tables.DatasetConfig import DatasetConfig
from synicix_ml_pipeline.datajoint_tables.TrainingConfig import TrainingConfig

[docs]@schema class TrainingTask(dj.Manual, BaseTable): """ A dj.Manual table class that handle the storage of training tasks which is a subset of all possiable combination of DatasetConfig, ModelConfig and DatasetConfig Typical usage of this class is done by using the method insert_tuples. An example of this can be found in the Pipeline Configuration Jupyter Notebook """ definition = """ training_task_id : int unsigned --- -> DatasetConfig -> ModelConfig -> TrainingConfig trial : smallint unsigned """
[docs] @classmethod def insert_tuple(cls, tuple_dicts, trials): """ Function to handle inserting Training Tasks by computing the md5_hash for each entry and inserting into the database Parameters: tuple_dict: A dict or a list of dicts containing the columns of the table defintion of TrainingTask Returns: None """ for i in range(trials): for tuple_dict in tuple_dicts: tuple_dict['trial'] = i super(TrainingTask, cls).insert_tuples(tuple_dicts)