sakura.model_controllers.extractor_controller.ExtractorController

class sakura.model_controllers.extractor_controller.ExtractorController(model: Extractor, config: dict | None = None, pheno_config: dict | None = None, signature_config: dict | None = None, verbose=False)

Bases: object

Central controller class managing the complete training lifecycle of the Extractor model

This class provides the core controller for the Extractor model. It handles multi-component loss calculation, dynamic weight adjustment, distributed regularization, and training workflow management.

Parameters:
  • model (models.Extractor) – Extractor model

  • config (dict, optional) – experiment configuration dict

  • pheno_config (dict, optional) – phenotype supervision configuration

  • signature_config (dict, optional) – signature supervision configuration

  • verbose (bool, optional) – Whether to enable verbose console logging, defaults to False

Methods

eval

Evaluate the model using the specified batch of data.

load_checkpoint

Restore training state of the extractor from given checkpoint.

loss

Calculate composite loss across all active components.

next_epoch

Handle inter epoch loss weight progressions and tick epoch counters.

print_weight_projection

Print the projected weights for main latent, phenotype, and signature groups over the expected epochs.

regularize

Handle regularization to the given tensor based on the specified configuration.

reset

Reset the trainer's state.

save_checkpoint

Save the current training state of the extractor.

select_item_dict

Utility method to handle selections from internal phenotype/signature configs.

select_loss_dict

Select loss keys from the internal dict based on selection setting.

setup_optimizer

Configure optimizer with filtered parameters based on exclusion rules.

tick

Increment the current tick counter.

train

Train the model using the spectrain(ified batch of data.