deephyper.nas.trainer.BaseTrainer#

class deephyper.nas.trainer.BaseTrainer(config, model)[source]#

Bases: object

Methods

evaluate

Evaluate the performance of your model for the same configuration.

init_history

load_data

load_data_generator

load_data_ndarray

model_compile

predict

[summary]

preprocess_data

set_dataset_train

set_dataset_valid

setup_losses_and_metrics

train

Train the model.

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:

list

predict(dataset: str = 'valid', keep_normalize: bool = False) tuple[source]#

[summary]

Parameters:
  • dataset (str, optional) – ‘valid’ or ‘train’. Defaults to ‘valid’.

  • keep_normalize (bool, optional) – if False then the preprocessing will be reversed after prediction. if True nothing will be reversed. Defaults to False.

Raises:

DeephyperRuntimeError – [description]

Returns:

(y_true, y_pred)

Return type:

tuple

train(num_epochs: 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:

dict