예제 #1
0
    weight_decay = 5e-4
    epochs = 50

    # Utils
    batch_size = 256
    records = []
    torch.manual_seed(0)

    # Load data
    train_loader, test_loader = load_data(batch_size)
    print('Finish loading data...\n')

    # FusionRegressor
    model = FusionRegressor(estimator=MLP,
                            n_estimators=n_estimators,
                            output_dim=output_dim,
                            lr=lr,
                            weight_decay=weight_decay,
                            epochs=epochs)

    tic = time.time()
    model.fit(train_loader)
    toc = time.time()
    training_time = toc - tic

    tic = time.time()
    testing_mse = model.predict(test_loader)
    toc = time.time()
    evaluating_time = toc - tic

    records.append(
        ('FusionRegressor', training_time, evaluating_time, testing_mse))
    epochs = 50

    # Utils
    batch_size = 512
    records = []
    torch.manual_seed(0)

    # Load data
    train_loader, test_loader = load_data(batch_size)
    print("Finish loading data...\n")

    logger = set_logger("regression_YearPredictionMSD_mlp")

    # FusionRegressor
    model = FusionRegressor(estimator=MLP,
                            n_estimators=n_estimators,
                            cuda=True)

    # Set the optimizer
    model.set_optimizer("Adam", lr=lr, weight_decay=weight_decay)

    tic = time.time()
    model.fit(train_loader, epochs=epochs)
    toc = time.time()
    training_time = toc - tic

    tic = time.time()
    testing_mse = model.predict(test_loader)
    toc = time.time()
    evaluating_time = toc - tic