Beispiel #1
0
if __name__ == "__main__":

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

    print("Train LPMC_RR_L with LS-ABS and grad")

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

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

    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_grad.json', 'w') as outfile:
            json.dump(res, outfile)

        print("{}/20 done!".format(i + 1))
Beispiel #2
0
    base_param = {'perc_hybrid': 30, '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/parameters_RR.json', 'w') as outfile:
            json.dump(res, outfile)

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

    print("")
    print("Start with thresh_upd")