예제 #1
0
import json

from algos import OptAlg

from models import LPMC_DC

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

if __name__ == "__main__":

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

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

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

from algos import OptAlg

from models import LPMC_DC

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

if __name__ == "__main__":

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

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

    model = LPMC_DC(data_folder)

    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'])
예제 #3
0
from algos import OptAlg

from models import LPMC_DC

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_DC(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, 'max_epochs': 1000, 'batch': 1000}
    main_params.update(base_param)

    draws = 10

    res = {}

    print("Start with perc_hybrid")

    param_ph = [0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100]
예제 #4
0
import os
import time
import json

from models import LPMC_DC

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

if __name__ == "__main__":

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

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

    model = LPMC_DC(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
예제 #5
0
import os
import time
import json

from models import LPMC_DC

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

if __name__ == "__main__":

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

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

    model = LPMC_DC(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_DC

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

if __name__ == "__main__":

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

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

    model = LPMC_DC(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