Esempio n. 1
0
if __name__ == "__main__":

    if not os.path.exists('./results'):
        os.makedirs('./results')

    print("Train LPMC_Full_L with LS-ABS and hybrid-inv")

    model = LPMC_Full(data_folder, file='12_13_14.csv')

    ioa = OptAlg(alg_type='LS-ABS', direction='hybrid-inv')

    res = {'time': [], 'LL': [], 'epochs': []}

    for i in range(20):

        tmp = model.optimize(
            ioa, **{
                'verbose': False,
                'max_epochs': 1000,
                'batch': 1000
            })

        res['time'].append(tmp['opti_time'])
        res['LL'].append(tmp['fun'])
        res['epochs'].append(tmp['nep'])

        with open('results/LS-ABS_hybrid-inv.json', 'w') as outfile:
            json.dump(res, outfile)

        print("{}/20 done!".format(i + 1))
Esempio n. 2
0
        'thresh_upd': 1,
        'count_upd': 2,
        'window': 10,
        'factor_upd': 2
    }

    main_params = {'verbose': False, 'nbr_epochs': 1000, 'batch': 1000}
    main_params.update(base_param)

    draws = 20

    res = {}

    tmp_res = {'time': [], 'LL': [], 'epochs': []}

    print("Start with base params")

    for i in range(draws):

        tmp = model.optimize(ioa, **main_params)

        tmp_res['time'].append(tmp['opti_time'])
        tmp_res['LL'].append(tmp['fun'])
        tmp_res['epochs'].append(tmp['nep'])

        res['base'] = tmp_res

        with open('results/Full_base.json', 'w') as outfile:
            json.dump(res, outfile)

        print("{}/{} done!".format(i + 1, draws))