def train(self, dataset: BaseADDataset, optimizer_name: str = 'adam', lr: float = 0.001, n_epochs: int = 50,
              lr_milestones: tuple = (), batch_size: int = 128, weight_decay: float = 1e-6, device: str = 'cuda',
              n_jobs_dataloader: int = 0):
        """Trains the Semi-Supervised Deep Generative model on the training data."""

        self.optimizer_name = optimizer_name

        self.trainer = SemiDeepGenerativeTrainer(alpha=self.alpha, optimizer_name=optimizer_name, lr=lr,
                                                 n_epochs=n_epochs, lr_milestones=lr_milestones, batch_size=batch_size,
                                                 weight_decay=weight_decay, device=device,
                                                 n_jobs_dataloader=n_jobs_dataloader)
        self.net = self.trainer.train(dataset, self.net)
        self.results['train_time'] = self.trainer.train_time
Trains the Semi-Supervised Deep Generative model on the training data.
adbench/baseline/DeepSAD/src/baselines/SemiDGM.py