MCPcopy Create free account
hub / github.com/BioinfoMachineLearning/FlowDock / main

Function main

flowdock/train.py:172–191  ·  view source on GitHub ↗

Main entry point for training. :param cfg: DictConfig configuration composed by Hydra. :return: Optional[float] with optimized metric value.

(cfg: DictConfig)

Source from the content-addressed store, hash-verified

170
171@hydra.main(version_base="1.3", config_path="../configs", config_name="train.yaml")
172def main(cfg: DictConfig) -> Optional[float]:
173 """Main entry point for training.
174
175 :param cfg: DictConfig configuration composed by Hydra.
176 :return: Optional[float] with optimized metric value.
177 """
178 # apply extra utilities
179 # (e.g. ask for tags if none are provided in cfg, print cfg tree, etc.)
180 extras(cfg)
181
182 # train the model
183 metric_dict, _ = train(cfg)
184
185 # safely retrieve metric value for hydra-based hyperparameter optimization
186 metric_value = get_metric_value(
187 metric_dict=metric_dict, metric_name=cfg.get("optimized_metric")
188 )
189
190 # return optimized metric
191 return metric_value
192
193
194if __name__ == "__main__":

Callers 1

train.pyFile · 0.70

Calls 4

extrasFunction · 0.90
get_metric_valueFunction · 0.90
trainFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected