Esempio n. 1
0
    def __init__(self, args):
        log_dir = '../../logs/linkload_prediction/{}_{}_{}_{}_{}_{}'.format(args.model, args.dataset, args.seq_len_x,
                                                                   args.seq_len_y, args.loss_fn, args.type)
        if args.tod:
            log_dir = log_dir + '_tod'
        if args.ma:
            log_dir = log_dir + '_ma'
        if args.mx:
            log_dir = log_dir + '_mx'

        if not os.path.exists(log_dir):
            os.makedirs(log_dir)
        args.log_dir = log_dir
        pickle_save(args, '{}/args.pkl'.format(args.log_dir))

        if args.verbose:
            print('[+] creating logger:', log_dir)
        self.writer = SummaryWriter(log_dir=log_dir)
        self.log_dir = log_dir

        self.args = args
        self.min_val_loss = np.inf
        self.patience = 0
        self.loss_fn = args.loss_fn
        self.best_model_save_path = os.path.join(args.log_dir, 'best_model.pth')

        self.metrics = []
        self.stop = False
        self.Xhat = None
Esempio n. 2
0
    def __init__(self, args):
        log_dir = '../../logs/icc/imputation/{}_{}_{}/{}_{}/{}_{}_{}/'. \
            format(args.model, args.num_layers, args.residual_channels, args.dataset, args.seq_len, args.type,
                   args.sr, args.seed)
        if args.verbose:
            print('[+] creating logger:', log_dir)

        if not os.path.exists(log_dir):
            os.makedirs(log_dir)
        args.log_dir = log_dir
        pickle_save(args, '{}/args.pkl'.format(args.log_dir))

        self.log_dir = log_dir

        self.imp_saving_path = os.path.join(
            args.savingpath, '{}_{}_{}_{}'.format(args.model, args.dataset,
                                                  args.sr, args.type))
        if not os.path.exists(self.imp_saving_path):
            os.makedirs(self.imp_saving_path)

        self.args = args
        self.min_val_loss = np.inf
        self.patience = 0
        self.best_model_save_path = os.path.join(
            args.log_dir, 'best_model_{}.pth'.format(args.impset))

        self.metrics = []
        self.stop = False
        self.Xhat = None
Esempio n. 3
0
    parser.add_argument('--learning_rate',
                        type=float,
                        default=0.001,
                        help='learning rate')
    parser.add_argument('--lr_decay_rate',
                        type=float,
                        default=0.97,
                        help='learning rate')
    parser.add_argument('--save',
                        type=str,
                        default='experiment',
                        help='save path')
    parser.add_argument('--n_iters',
                        default=None,
                        help='quit after this many iterations')
    parser.add_argument(
        '--es_patience',
        type=int,
        default=20,
        help='quit if no improvement after this many iterations')

    args = parser.parse_args()
    t1 = time.time()
    if not os.path.exists(args.save):
        os.mkdir(args.save)
    pickle_save(args, f'{args.save}/args.pkl')
    main(args)
    t2 = time.time()
    mins = (t2 - t1) / 60
    print(f"Total time spent: {mins:.2f} seconds")