mednet.models.classify.training_steps

Functions

default_training_step(model, batch, batch_idx)

Perform a training step.

fairness_aware_training_step(model, batch, ...)

Perform a fairnesss-aware training step, for use with losses expecting a target and sensitive attributes.

mednet.models.classify.training_steps.default_training_step(model, batch, batch_idx)[source]

Perform a training step.

Parameters:
  • model (Model) – Instance of mednet.models.classify.model.Model to use the training step with.

  • batch – The batch to apply the training step on. Should contain image and target keys.

  • batch_idx – The index of the batch, will be ignored.

Returns:

The value of training loss for the batch.

mednet.models.classify.training_steps.fairness_aware_training_step(model, batch, batch_idx)[source]

Perform a fairnesss-aware training step, for use with losses expecting a target and sensitive attributes.

Parameters:
  • model (Model) – Instance of mednet.models.classify.model.Model to use the training step with.

  • batch – The batch to apply the training step on. Should contain image, target and sensitive_attr keys.

  • batch_idx – The index of the batch, will be ignored.

Returns:

The value of training loss for the batch.