def RunExperiment(trainVal_loader,
                  test_loader,
                  epochs,
                  torchOptim,
                  lossFn,
                  net,
                  results_directory,
                  name,
                  device='cpu',
                  saveAccToo=False,
                  saveNetDict=True):
    losses = train(net,
                   trainVal_loader,
                   test_loader,
                   torchOptim,
                   lossFn,
                   0,
                   epochs,
                   name,
                   device=device,
                   checkForDiv=True,
                   saveAccToo=saveAccToo,
                   pathToSave=results_directory,
                   saveNetDict=saveNetDict)
    np.savetxt(results_directory + name + '.txt', np.array(losses), fmt='%s')
Exemplo n.º 2
0
def RunExperiment(X_train,
                  X_val,
                  X_test,
                  labels_train,
                  labels_val,
                  labels_test,
                  train_loader,
                  val_loader,
                  epochs,
                  torchOptim,
                  lossFn,
                  net,
                  results_directory,
                  name,
                  device='cpu',
                  saveAccToo=False):
    losses = train(net,
                   train_loader,
                   val_loader,
                   torchOptim,
                   lossFn,
                   0,
                   epochs,
                   name,
                   device=device,
                   checkForDiv=True)
    np.savetxt(results_directory + name + '.txt', np.array(losses))
Exemplo n.º 3
0
def RunExperiment(net, train_loader, train_loader_oversampled, val_loader, \
    val_loader_oversampled, Y_tr_np, Y_val_np, epochs, torchOptim, lossFnTr, lossFnVal, \
    results_directory, name, lossSigm, device, saveNetDict, scheduler, tol):
    losses = train(net, train_loader, train_loader_oversampled, val_loader, \
        val_loader_oversampled, Y_tr_np, Y_val_np, torchOptim, lossFnTr, lossFnVal, 0, epochs,\
        name, device, lossSigm, checkForDiv = True, pathToSave = results_directory,\
        saveNetDict = saveNetDict, scheduler = scheduler, tol = tol)
    np.savetxt(results_directory + name + '.txt', np.array(losses), fmt='%s')
Exemplo n.º 4
0
def RunExpSavNetAndUsingTest(train_loader, test_loader, epochs, torchOptim, lossFn, net, results_directory, name, device = 'cpu', saveAccToo = False, saveNetDict = True):
    losses = train(net, train_loader, test_loader, torchOptim, lossFn, 0, epochs, name, device = device, checkForDiv = True, saveNetDict = saveNetDict, pathToSave = results_directory)
    np.savetxt(results_directory + name + '.txt', np.array(losses))