deephyper.nas.trainer
deephyper.nas.trainer¶
-
class
deephyper.nas.trainer.
BaseTrainer
(config, model)[source]¶ Bases:
object
-
evaluate
(dataset='train')[source]¶ Evaluate the performance of your model for the same configuration.
- Parameters
dataset (str, optional) – must be “train” or “valid”. If “train” then metrics will be evaluated on the training dataset. If “valid” then metrics will be evaluated on the “validation” dataset. Defaults to ‘train’.
- Returns
a list of scalar values corresponding do config loss & metrics.
- Return type
-
predict
(dataset: str = 'valid', keep_normalize: bool = False) → tuple[source]¶ [summary]
- Parameters
- Raises
DeephyperRuntimeError – [description]
- Returns
(y_true, y_pred)
- Return type
-
train
(num_epochs: Optional[int] = None, with_pred: bool = False, last_only: bool = False)[source]¶ Train the model.
- Parameters
num_epochs (int, optional) – override the num_epochs passed to init the Trainer. Defaults to None, will use the num_epochs passed to init the Trainer.
with_pred (bool, optional) – will compute a prediction after the training and will add (‘y_true’, ‘y_pred’) to the output history. Defaults to False, will skip it (use it to save compute time).
last_only (bool, optional) – will compute metrics after the last epoch only. Defaults to False, will compute metrics after each training epoch (use it to save compute time).
- Raises
DeephyperRuntimeError – raised when the
num_epochs < 0
.- Returns
a dictionnary corresponding to the training.
- Return type
-
-
class
deephyper.nas.trainer.
HorovodTrainer
(config, model)[source]¶ Bases:
object
-
evaluate
(dataset='train')[source]¶ Evaluate the performance of your model for the same configuration.
- Parameters
dataset (str, optional) – must be “train” or “valid”. If “train” then metrics will be evaluated on the training dataset. If “valid” then metrics will be evaluated on the “validation” dataset. Defaults to ‘train’.
- Returns
a list of scalar values corresponding do config loss & metrics.
- Return type
-
predict
(dataset: str = 'valid', keep_normalize: bool = False) → tuple[source]¶ [summary]
- Parameters
- Raises
DeephyperRuntimeError – [description]
- Returns
(y_true, y_pred)
- Return type
-
train
(num_epochs: Optional[int] = None, with_pred: bool = False, last_only: bool = False)[source]¶ Train the model.
- Parameters
num_epochs (int, optional) – override the num_epochs passed to init the Trainer. Defaults to None, will use the num_epochs passed to init the Trainer.
with_pred (bool, optional) – will compute a prediction after the training and will add (‘y_true’, ‘y_pred’) to the output history. Defaults to False, will skip it (use it to save compute time).
last_only (bool, optional) – will compute metrics after the last epoch only. Defaults to False, will compute metrics after each training epoch (use it to save compute time).
- Raises
DeephyperRuntimeError – raised when the
num_epochs < 0
.- Returns
a dictionnary corresponding to the training.
- Return type
-