Example #1
0
def multiclass_classification(attention_model,
                              train_loader,
                              epochs=5,
                              use_regularization=True,
                              C=1.0,
                              clip=True):
    loss = torch.nn.NLLLoss()
    optimizer = torch.optim.RMSprop(attention_model.parameters())
    train(attention_model, train_loader, loss, optimizer, epochs,
          use_regularization, C, clip)
Example #2
0
def multilabel_classification(attention_model,
                              train_loader,
                              test_loader,
                              epochs,
                              GPU=True):
    loss = torch.nn.BCELoss()
    opt = torch.optim.Adam(attention_model.parameters(),
                           lr=0.001,
                           betas=(0.9, 0.99))
    train(attention_model, train_loader, test_loader, loss, opt, epochs, GPU)
Example #3
0
def binary_classfication(attention_model,
                         train_loader,
                         epochs=5,
                         use_regularization=True,
                         C=1.0,
                         clip=True):
    loss = torch.nn.BCELoss()
    optimizer = torch.optim.RMSprop(attention_model.parameters())
    train(params_set, attention_model, train_loader, loss, optimizer, epochs,
          use_regularization, C, clip)
def multiclass_classification(attention_model,train_loader,epochs=5,use_regularization=True,C=1.0,clip=True):
    loss = torch.nn.NLLLoss()
    optimizer = torch.optim.RMSprop(attention_model.parameters())
    train(attention_model,train_loader,loss,optimizer,epochs,use_regularization,C,clip)