from utils.eval import eval_proced

print('STARTING UNCONTROLLED EXPERIMENTS WITH EASE')
print('SEEDS ARE: {}'.format(UN_SEEDS))

grid = {'lam': [1, 1e1, 1e2, 5e2, 1e3, 1e4, 1e5, 1e6, 1e7]}
pg = ParameterGrid(grid)

now = datetime.now()

for seed in tqdm(UN_SEEDS, desc='seeds'):

    log_val_str = UN_LOG_VAL_STR.format('ease', now, seed)
    log_te_str = UN_LOG_TE_STR.format('ease', now, seed)

    ds = DataSplitter(DATA_PATH, PERS_PATH, out_dir=UN_OUT_DIR)
    pandas_dir_path, scipy_dir_path, uids_dic_path, tids_path = ds.get_paths(
        seed)

    # Load data
    sp_tr_data = sp.load_npz(os.path.join(scipy_dir_path, 'sp_tr_data.npz'))
    sp_vd_tr_data = sp.load_npz(
        os.path.join(scipy_dir_path, 'sp_vd_tr_data.npz'))
    sp_vd_te_data = sp.load_npz(
        os.path.join(scipy_dir_path, 'sp_vd_te_data.npz'))
    sp_te_tr_data = sp.load_npz(
        os.path.join(scipy_dir_path, 'sp_te_tr_data.npz'))
    sp_te_te_data = sp.load_npz(
        os.path.join(scipy_dir_path, 'sp_te_te_data.npz'))

    low_high_indxs = dict()
Exemplo n.º 2
0
    experiment_type = args.experiment_type
    gpu = args.gpu

    print('STARTING EXPERIMENTS <{}> WITH VAE'.format(experiment_type))

    device = 'cuda:{}'.format(gpu) if torch.cuda.is_available() else 'cpu'
    data_path = DOWN_DATA_PATH if experiment_type == 'down_sample' else DATA_PATH
    demo_path = DOWN_DEMO_PATH if experiment_type == 'down_sample' else DEMO_PATH

    for fold_n in trange(5, desc='folds'):

        log_val_str = LOG_VAL_STR.format('vae', experiment_type, now, fold_n)
        log_te_str = LOG_TE_STR.format('vae', experiment_type, now, fold_n)

        ds = DataSplitter(data_path, demo_path, out_dir=OUT_DIR)
        pandas_dir_path, scipy_dir_path, uids_dic_path, tids_path = ds.get_paths(
            fold_n=fold_n)

        if experiment_type == 'up_sample':
            ds.up_sample_train_data_path(pandas_dir_path, scipy_dir_path,
                                         'gender')

        # Setting seed for reproducibility
        reproducible(EXP_SEED)

        # --- Data --- #
        tr_loader = DataLoader(LFM2bDataset(
            scipy_dir_path,
            which='train',
            up_sample=experiment_type == 'up_sample'),
Exemplo n.º 3
0
print('STARTING CONTROLLED EXPERIMENTS WITH ESAE')
print('SEEDS ARE: {}'.format(SEEDS))

grid = {'lam': [1, 1e1, 1e2, 5e2, 1e3, 1e4, 1e5, 1e6, 1e7]}
pg = ParameterGrid(grid)

now = datetime.now()

for trait in tqdm(TRAITS, desc='traits'):
    print('WORKING ON TRAIT: ' + trait)
    for seed in tqdm(SEEDS, desc='seeds'):

        log_val_str = LOG_VAL_STR.format('ease', now, trait, seed)
        log_te_str = LOG_TE_STR.format('ease', now, trait, seed)

        ds = DataSplitter(DATA_PATH, PERS_PATH, out_dir=OUT_DIR)
        pandas_dir_path, scipy_dir_path, uids_dic_path, tids_path = ds.get_paths(
            seed, trait)

        # Load data
        sp_tr_data = sp.load_npz(os.path.join(scipy_dir_path,
                                              'sp_tr_data.npz'))
        sp_vd_tr_data = sp.load_npz(
            os.path.join(scipy_dir_path, 'sp_vd_tr_data.npz'))
        sp_vd_te_data = sp.load_npz(
            os.path.join(scipy_dir_path, 'sp_vd_te_data.npz'))
        sp_te_tr_data = sp.load_npz(
            os.path.join(scipy_dir_path, 'sp_te_tr_data.npz'))
        sp_te_te_data = sp.load_npz(
            os.path.join(scipy_dir_path, 'sp_te_te_data.npz'))