コード例 #1
0
ファイル: biogeme_bfgs.py プロジェクト: glederrey/HAMABS
import os
import time
import json

from models import MTMC

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

if __name__ == "__main__":

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

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

    model = MTMC(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
コード例 #2
0
import json

from algos import OptAlg

from models import MTMC

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

if __name__ == "__main__":

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

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

    model = MTMC(data_folder)

    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'])
コード例 #3
0
ファイル: HAMABS.py プロジェクト: glederrey/HAMABS
import sys
sys.path.append("../..")

import os

from algos import OptAlg

from models import MTMC

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

if __name__ == "__main__":

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

    print("Train MTMC_MNL with HAMABS")

    model = MTMC(data_folder)

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

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