mlguess.keras package#

Submodules#

mlguess.keras.callbacks module#

class mlguess.keras.callbacks.LearningRateTracker#

Bases: Callback

on_epoch_end(epoch: int, logs: Dict[str, float] | None = None) None#

Called at the end of an epoch.

Subclasses should override for any actions to run. This function should only be called during TRAIN mode.

Parameters:
  • epoch – Integer, index of epoch.

  • logs – Dict, metric results for this training epoch, and for the validation epoch if validation is performed. Validation result keys are prefixed with val_. For training epoch, the values of the Model’s metrics are returned. Example: {‘loss’: 0.2, ‘accuracy’: 0.7}.

class mlguess.keras.callbacks.MetricsCallback(x, y, name='val', n_bins=10, use_uncertainty=False, **kwargs)#

Bases: Callback

ave_acc(true_labels, pred_labels)#
ece(true_labels, pred_probs)#
mce(true_labels, pred_probs)#
mean_csi(pred_probs)#
on_epoch_end(epoch, logs={})#

Called at the end of an epoch.

Subclasses should override for any actions to run. This function should only be called during TRAIN mode.

Parameters:
  • epoch – Integer, index of epoch.

  • logs – Dict, metric results for this training epoch, and for the validation epoch if validation is performed. Validation result keys are prefixed with val_. For training epoch, the values of the Model’s metrics are returned. Example: {‘loss’: 0.2, ‘accuracy’: 0.7}.

class mlguess.keras.callbacks.ReportEpoch(epoch_var)#

Bases: Callback

on_epoch_begin(epoch, logs=None)#

Called at the start of an epoch.

Subclasses should override for any actions to run. This function should only be called during TRAIN mode.

Parameters:
  • epoch – Integer, index of epoch.

  • logs – Dict. Currently no data is passed to this argument for this method but that may change in the future.

mlguess.keras.callbacks.get_callbacks(config: Dict[str, str], path_extend=False) List[Callback]#
mlguess.keras.callbacks.step_decay(epoch, drop=0.2, epochs_drop=5.0, init_lr=0.001)#

mlguess.keras.layers module#

mlguess.keras.losses module#

mlguess.keras.models module#

mlguess.keras.models_deprecated module#

mlguess.keras.monte_carlo module#

mlguess.keras.monte_carlo.monte_carlo_ensemble(model, x_test, y_test, forward_passes, y_scaler=None)#

Function to get the monte-carlo samples and uncertainty estimates through multiple forward passes

Parameters:
  • data_loader (object) – data loader object from the data loader module

  • forward_passes (int) – number of monte-carlo samples/forward passes

  • model (mlguess) – keras model

  • n_classes (int) – number of classes in the dataset

  • y_scaler (sklearn Scaler) – perform inverse scaler on predicted

mlguess.keras.monte_carlo.reset_weights(model)#

mlguess.keras.seed module#

mlguess.keras.seed.seed_everything(seed=42)#

Module contents#