snn.utils¶
Data¶
- snn.utils.to_categorical(y, num_classes=None)[source]¶
Convert integer class labels to one-hot vectors.
Gradient Utilities¶
Learning Rate Schedules¶
- snn.utils.learning_rate_schedule(initial_lr, decay_rate=0.96, decay_steps=1000)[source]¶
Return a callable exponential LR schedule.
Callbacks¶
- class snn.utils.EarlyStopping(monitor='val_loss', patience=5, min_delta=0.0, mode='auto', restore_best_weights=False, verbose=1)[source]¶
Bases:
objectStop training when a monitored metric has stopped improving.
- Parameters:
monitor (str) – Name of the metric to watch (e.g. ‘val_loss’).
patience (int) – Number of epochs with no improvement before stopping.
min_delta (float) – Minimum change to qualify as an improvement.
mode (str) – ‘min’ for loss-like metrics, ‘max’ for accuracy-like.
restore_best_weights (bool) – If True, restore the best weights when training stops.
- property stopped¶
- class snn.utils.ReduceLROnPlateau(monitor='val_loss', factor=0.5, patience=3, min_lr=1e-06, verbose=1)[source]¶
Bases:
objectReduce learning rate when a metric has stopped improving.
- Parameters:
monitor (str)
factor (float) – Factor by which the learning rate will be reduced.
patience (int)
min_lr (float) – Lower bound for the learning rate.
verbose (int)