예제 #1
0
import json

from algos import OptAlg

from models import LPMC_RR

data_folder = '../../../data/'

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'])
예제 #2
0
import json

from algos import OptAlg

from models import LPMC_RR

data_folder = '../../../data/'

if __name__ == "__main__":

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

    print("Train LPMC_RR_M with TR and bfgs")

    model = LPMC_RR(data_folder)

    ioa = OptAlg(alg_type='TR', direction='bfgs')

    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'])
예제 #3
0
import os
import time
import json

from models import LPMC_RR

data_folder = '../../../data/'

if __name__ == "__main__":

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

    print("Train LPMC_RR with current Biogeme optimization algorithm.")

    model = LPMC_RR(data_folder)

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

    for i in range(20):

        results = model.biogeme.estimate()

        res['time'].append(model.biogeme.optimizationTime.total_seconds())
        res['LL'].append(results.data.logLike)
        res['epochs'].append(model.biogeme.numberOfIterations)

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

        # Delete pickle files
예제 #4
0
from algos import OptAlg

from models import LPMC_RR

data_folder = '../../../data/'

if __name__ == "__main__":

    parameters = {''}

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

    print("Testing parameters for LPMC_RR_L")

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

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

    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")
예제 #5
0
import os
import time
import json

from models import LPMC_RR

data_folder = '../../../data/'

if __name__ == "__main__":

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

    print("Train LPMC_RR with current Biogeme optimization algorithm.")

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

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

    for i in range(20):

        results = model.biogeme.estimate()

        res['time'].append(model.biogeme.optimizationTime.total_seconds())
        res['LL'].append(results.data.logLike)
        res['epochs'].append(model.biogeme.numberOfIterations)

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

        # Delete pickle files
예제 #6
0
import os
import time
import json

from models import LPMC_RR

data_folder = '../../../data/'

if __name__ == "__main__":

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

    print("Train LPMC_RR with current Biogeme optimization algorithm.")

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

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

    for i in range(20):

        results = model.biogeme.estimate()

        res['time'].append(model.biogeme.optimizationTime.total_seconds())
        res['LL'].append(results.data.logLike)
        res['epochs'].append(model.biogeme.numberOfIterations)

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

        # Delete pickle files