multiml.task.keras.modules.darts_model module
- class multiml.task.keras.modules.darts_model.SumTensor(*args, **kwargs)
Bases:
MeanTensor
- result()
Computes and returns the metric value tensor.
Result computation is an idempotent operation that simply calculates the metric value using the state variables.
- class multiml.task.keras.modules.darts_model.DARTSModel(*args, **kwargs)
Bases:
ConnectionModel
- __init__(optimizer_alpha, optimizer_weight, learning_rate_alpha, learning_rate_weight, zeta, *args, **kwargs)
Constructor.
- Parameters:
optimizer_alpha (str) – optimizer for alpha in DARTS optimization
optimizer_weight (str) – optimizer for weight in DARTS optimization
learning_rate_alpha (float) – learning rate (epsilon) for alpha in DARTS optimization
learning_rate_weight (float) – learning rate (epsilon) for weight in DARTS optimization
zeta (float) – zeta parameter in DARTS optimization
- train_step(data)
The logic for one training step.
This method can be overridden to support custom training logic. This method is called by Model.make_train_function.
This method should contain the mathematical logic for one step of training. This typically includes the forward pass, loss calculation, backpropagation, and metric updates.
Configuration details for how this logic is run (e.g. tf.function and tf.distribute.Strategy settings), should be left to Model.make_train_function, which can also be overridden.
- Parameters:
data – A nested structure of `Tensor`s.
- Returns:
A dict containing values that will be passed to tf.keras.callbacks.CallbackList.on_train_batch_end. Typically, the values of the Model’s metrics are returned. Example: {‘loss’: 0.2, ‘accuracy’: 0.7}.
- test_step(data)
The logic for one evaluation step.
This method can be overridden to support custom evaluation logic. This method is called by Model.make_test_function.
This function should contain the mathematical logic for one step of evaluation. This typically includes the forward pass, loss calculation, and metrics updates.
Configuration details for how this logic is run (e.g. tf.function and tf.distribute.Strategy settings), should be left to Model.make_test_function, which can also be overridden.
- Parameters:
data – A nested structure of `Tensor`s.
- Returns:
A dict containing values that will be passed to tf.keras.callbacks.CallbackList.on_train_batch_end. Typically, the values of the Model’s metrics are returned.
- get_index_of_best_submodels()