smoother.models.reduction._utils

Functions

iterate(obj, func)

Iterates over an object and applies a function to each element.

broadcast_labels(y, *o[, n_broadcast])

Utility for the semi-supervised setting.

enumerate_discrete(x, y_dim)

Enumerate discrete variables.

get_max_epochs_heuristic(→ int)

Compute a heuristic for the default number of maximum epochs.

set_params_online_update(module, unfrozen, ...)

Freeze parts of network for scArches.

Module Contents

smoother.models.reduction._utils.iterate(obj, func)

Iterates over an object and applies a function to each element.

smoother.models.reduction._utils.broadcast_labels(y, *o, n_broadcast=-1)

Utility for the semi-supervised setting.

If y is defined(labelled batch) then one-hot encode the labels (no broadcasting needed) If y is undefined (unlabelled batch) then generate all possible labels (and broadcast other arguments if not None)

smoother.models.reduction._utils.enumerate_discrete(x, y_dim)

Enumerate discrete variables.

smoother.models.reduction._utils.get_max_epochs_heuristic(n_obs: int, epochs_cap: int = 400, decay_at_n_obs: int = 20000) int

Compute a heuristic for the default number of maximum epochs.

If n_obs <= decay_at_n_obs, the number of maximum epochs is set to epochs_cap. Otherwise, the number of maximum epochs decays according to (decay_at_n_obs / n_obs) * epochs_cap, with a minimum of 1.

Parameters:
  • n_obs – The number of observations in the dataset.

  • epochs_cap – The maximum number of epochs for the heuristic.

  • decay_at_n_obs – The number of observations at which the heuristic starts decaying.

Returns:

A heuristic for the default number of maximum epochs.

Return type:

int

smoother.models.reduction._utils.set_params_online_update(module, unfrozen, freeze_decoder_first_layer, freeze_batchnorm_encoder, freeze_batchnorm_decoder, freeze_dropout, freeze_expression, freeze_classifier)

Freeze parts of network for scArches.