def METHOD_NAME(self):
    self.hyperparameters['lr'] = float(self.hyperparameters['lr'])
    self.hyperparameters['wdecay'] = float(self.hyperparameters['wdecay'])
    if self.hyperparameters['optimizer'] == 'adam':
        optimizer = optim.Adam(
            self.model.parameters(), lr=self.hyperparameters['lr'],
            weight_decay=self.hyperparameters['wdecay'])
    elif self.hyperparameters['optimizer'] == 'adagrad':
        optimizer = optim.Adagrad(
            self.model.parameters(), lr=self.hyperparameters['lr'],
            weight_decay=self.hyperparameters['wdecay'])
    elif self.hyperparameters['optimizer'] == 'adadelta':
        optimizer = optim.Adadelta(
            self.model.parameters(), lr=self.hyperparameters['lr'],
            weight_decay=self.hyperparameters['wdecay'])
    elif self.hyperparameters['optimizer'] == 'rmsprop':
        optimizer = optim.RMSprop(
            self.model.parameters(), lr=self.hyperparameters['lr'],
            weight_decay=self.hyperparameters['wdecay'])
    elif self.hyperparameters['optimizer'] == 'asgd':
        optimizer = optim.ASGD(
            self.model.parameters(), lr=self.hyperparameters['lr'],
            t0=0, lambd=0., weight_decay=self.hyperparameters['wdecay'])
    elif self.hyperparameters['optimizer'] == 'sgd':
        optimizer = optim.SGD(
            self.model.parameters(), lr=self.hyperparameters['lr'],
            weight_decay=self.hyperparameters['wdecay'])
    else:
        print('Defaulting to vanilla SGD')
        optimizer = optim.SGD(
            self.model.parameters(), lr=self.hyperparameters['lr'])
    return optimizer