Example #1
0
    def load_data_c(self, config):
        """
        Load the data for your ML pipeline. Will be fed into `train`.

        :param config: object constructed with all the relevant arguments for `load_data`
        :type config: ```Union[dict, Config, Any]```

        :return: a call to .load_data with the config as params
        :rtype: ```Union[Tuple[tf.data.Dataset, tf.data.Dataset], Tuple[np.ndarray, np.ndarray]]```
        """
        return self.load_data(**to_d(config))
Example #2
0
    def train_c(self, config):
        """
        Run the training loop for your ML pipeline.

        :param config: object constructed with all the relevant arguments for `train`
        :type config: ```Union[dict, Config, Any]```

        :return: a call to .train with the config as params
        :rtype: ```train```
        """
        return self.train(**to_d(config))
Example #3
0
    def load_model_c(self, config):
        """
        Load the model.
        Takes a model object, or a pipeline that downloads & configures before returning a model object.

        :param config: object constructed with all the relevant arguments for `load_model`
        :type config: ```Union[dict, Config, Any]```

        :return: a call to .load_model with the config as params
        :rtype: ```load_model```
        """
        return self.load_model(**to_d(config))
Example #4
0
 def test_to_d(self) -> None:
     """
     Tests whether `to_d` creates the right dictionary
     """
     self.assertDictEqual(to_d({}), {})
     self.assertListEqual(*map(
         sorted,
         (
             to_d(ml_params.utils).keys(),
             (ml_params.utils.__all__ + [
                 "deepcopy",
                 "environ",
                 "getmembers",
                 "parse_to_argv_gen",
                 "partial",
                 "path",
                 "version_info",
                 "itemgetter",
             ]),
         ),
     ))
Example #5
0
 def test_properties(self) -> None:
     """
     Tests whether `BaseTrainer` has the right properties
     """
     self.assertListEqual(
         sorted(to_d(BaseTrainer).keys()),
         [
             "data",
             "load_data",
             "load_data_c",
             "load_model",
             "load_model_c",
             "model",
             "train",
             "train_c",
         ],
     )