Example #1
0
    for i in range(500):
        print("epoch: ", i)
        graph = generate_random_graph(100, 250).adj
        trainer.train2(graph, 10 * beta ** i)
        trainer.test()
    Timer.end('all')
    score = 0
    coef = 1
    for all_rewards in reversed(trainer.test_result):
        coef *= 0.9
        for rewards in all_rewards:
            score += 10 * coef * np.max(rewards)
            score += coef * np.mean(rewards)

    Timer.print()
    trainer.save_model()
    trainer.save_test_result()

    return -score


if __name__ == '__main__':
    Timer.disable()
    Counter.disable()
    os.makedirs("model", exist_ok=True)
    study = optuna.create_study()
    study.optimize(objective, timeout=3600 * 8, n_jobs=-1)

    print("params_{}".format(study.best_params))
    print("value_{}".format(study.best_value))