Re-estimate the Pareto optimal modelsΒΆ

The assisted specification algorithm generates a file containing the pareto optimal specification. This script is designed to re-estimate the Pareto optimal models. The catalog of specifications is defined in Specification of a catalog of models .

Michel Bierlaire, EPFL Sat Jun 28 2025, 20:58:22

import biogeme.biogeme_logging as blog
from biogeme.results_processing import compile_estimation_results

try:
    import matplotlib.pyplot as plt

    can_plot = True
except ModuleNotFoundError:
    can_plot = False
from biogeme_optimization.exceptions import OptimizationError
from biogeme.assisted import ParetoPostProcessing
from plot_b21multiple_models_spec import the_biogeme

PARETO_FILE_NAME = 'saved_results/b21multiple_models.pareto'

logger = blog.get_screen_logger(blog.INFO)
logger.info('Example b21process_pareto.py')

CSV_FILE = 'b21process_pareto.csv'
SEP_CSV = ','
Example b21process_pareto.py

The constructor of the Pareto post processing object takes two arguments:

  • the biogeme object,

  • the name of the file where the algorithm has stored the estimated models.

the_pareto_post = ParetoPostProcessing(
    biogeme_object=the_biogeme,
    pareto_file_name=PARETO_FILE_NAME,
)
Pareto set initialized from file with 46 elements [8 Pareto] and 0 invalid elements.
the_pareto_post.log_statistics()
Pareto: 8
Considered: 46
Removed: 11

Complete re-estimation of the best models, including the calculation of the statistics.

all_results = the_pareto_post.reestimate(recycle=False)
Biogeme parameters provided by the user.
*** Initial values of the parameters are obtained from the file __b21multiple_models_000000.iter
Parameter values restored from __b21multiple_models_000000.iter
Starting values for the algorithm: {'asc_train_ref': -0.2258687793484305, 'asc_train_diff_male': -1.143813270388272, 'asc_train_diff_GA': 1.9640765729367688, 'b_time': -1.6954663249160327, 'lambda_time': 0.3349609471317642, 'b_cost_ref': -1.0917317968750284, 'b_cost_diff_GA': 2.08984375, 'asc_car_ref': -0.2680465766282342, 'asc_car_diff_male': 0.23652328223007915, 'asc_car_diff_GA': -1.7926314693122745}
Optimization algorithm: hybrid Newton/BFGS with simple bounds [simple_bounds]
** Optimization: Newton with trust region for simple bounds
Iter.   asc_train_ref asc_train_diff_ asc_train_diff_          b_time     lambda_time      b_cost_ref  b_cost_diff_GA     asc_car_ref asc_car_diff_ma asc_car_diff_GA     Function    Relgrad   Radius      Rho
    0           -0.22            -1.2               2            -1.7            0.33            -1.1             1.2           -0.42            0.41            -1.1      4.9e+03     0.0011       10        1   ++
    1           -0.22            -1.2               2            -1.7            0.33            -1.1            0.97           -0.42            0.41            -1.1      4.9e+03    0.00015    1e+02      1.1   ++
    2           -0.22            -1.2               2            -1.7            0.33            -1.1            0.92           -0.42            0.41              -1      4.9e+03    7.3e-06    1e+03        1   ++
    3           -0.22            -1.2               2            -1.7            0.33            -1.1            0.92           -0.42            0.41              -1      4.9e+03    1.7e-08    1e+03        1   ++
Optimization algorithm has converged.
Relative gradient: 1.7491435403155407e-08
Cause of termination: Relative gradient = 1.7e-08 <= 6.1e-06
Number of function evaluations: 13
Number of gradient evaluations: 9
Number of hessian evaluations: 4
Algorithm: Newton with trust region for simple bound constraints
Number of iterations: 4
Proportion of Hessian calculation: 4/4 = 100.0%
Optimization time: 0:00:03.145249
Calculate second derivatives and BHHH
File b21multiple_models_000000~02.html has been generated.
File b21multiple_models_000000~02.yaml has been generated.
Biogeme parameters provided by the user.
*** Initial values of the parameters are obtained from the file __b21multiple_models_000001.iter
Parameter values restored from __b21multiple_models_000001.iter
Starting values for the algorithm: {'asc_train_ref': -0.5, 'asc_train_diff_GA': 0.06546763205082014, 'b_time': -5.67702237179112, 'b_cost': -0.365286151200328, 'asc_car_ref': -0.08154589437366519, 'asc_car_diff_GA': -0.5}
Optimization algorithm: hybrid Newton/BFGS with simple bounds [simple_bounds]
** Optimization: Newton with trust region for simple bounds
Iter.   asc_train_ref asc_train_diff_ asc_train_diff_          b_time          b_cost     asc_car_ref asc_car_diff_ma asc_car_diff_GA     Function    Relgrad   Radius      Rho
    0            -0.5               0           0.065            -5.7           -0.37          -0.082               0            -0.5        1e+04          1      0.5    -0.41    -
    1            -0.5               0           0.065            -5.7           -0.37          -0.082               0            -0.5        1e+04          1     0.25    -0.46    -
    2            -0.5               0           0.065            -5.7           -0.37          -0.082               0            -0.5        1e+04          1     0.12    -0.23    -
    3            -0.5               0           0.065            -5.7           -0.37          -0.082               0            -0.5        1e+04          1    0.062    -0.13    -
    4            -0.5               0           0.065            -5.7           -0.37          -0.082               0            -0.5        1e+04          1    0.031   -0.089    -
    5            -0.5               0           0.065            -5.7           -0.37          -0.082               0            -0.5        1e+04          1    0.016   -0.068    -
    6            -0.5               0           0.065            -5.7           -0.37          -0.082               0            -0.5        1e+04          1   0.0078   -0.057    -
    7            -0.5               0           0.065            -5.7           -0.37          -0.082               0            -0.5        1e+04          1   0.0039   -0.052    -
    8            -0.5               0           0.065            -5.7           -0.37          -0.082               0            -0.5        1e+04          1    0.002    -0.05    -
    9            -0.5               0           0.065            -5.7           -0.37          -0.082               0            -0.5        1e+04          1  0.00098   -0.049    -
   10            -0.5               0           0.065            -5.7           -0.37          -0.082               0            -0.5        1e+04          1  0.00049   -0.048    -
   11            -0.5               0           0.065            -5.7           -0.37          -0.082               0            -0.5        1e+04          1  0.00024   -0.048    -
   12            -0.5               0           0.065            -5.7           -0.37          -0.082               0            -0.5        1e+04          1  0.00012   -0.047    -
   13            -0.5               0           0.065            -5.7           -0.37          -0.082               0            -0.5        1e+04          1  6.1e-05   -0.047    -
   14            -0.5               0           0.065            -5.7           -0.37          -0.082               0            -0.5        1e+04          1  3.1e-05   -0.047    -
   15            -0.5               0           0.065            -5.7           -0.37          -0.082               0            -0.5        1e+04          1  1.5e-05   -0.047    -
   16            -0.5               0           0.065            -5.7           -0.37          -0.082               0            -0.5        1e+04          1  7.6e-06   -0.047    -
   17            -0.5               0           0.065            -5.7           -0.37          -0.082               0            -0.5        1e+04          1  3.8e-06   -0.047    -
   18            -0.5               0           0.065            -5.7           -0.37          -0.082               0            -0.5        1e+04          1  1.9e-06   -0.047    -
   19            -0.5               0           0.065            -5.7           -0.37          -0.082               0            -0.5        1e+04          1  9.5e-07   -0.047    -
   20            -0.5               0           0.065            -5.7           -0.37          -0.082               0            -0.5        1e+04          1  4.8e-07   -0.047    -
   21            -0.5               0           0.065            -5.7           -0.37          -0.082               0            -0.5        1e+04          1  2.4e-07   -0.047    -
   22            -0.5               0           0.065            -5.7           -0.37          -0.082               0            -0.5        1e+04          1  1.2e-07   -0.047    -
   23            -0.5               0           0.065            -5.7           -0.37          -0.082               0            -0.5        1e+04          1    6e-08   -0.047    -
   24            -0.5               0           0.065            -5.7           -0.37          -0.082               0            -0.5        1e+04          1    3e-08   -0.047    -
   25            -0.5               0           0.065            -5.7           -0.37          -0.082               0            -0.5        1e+04          1  1.5e-08   -0.047    -
Optimization algorithm has *not* converged.
Algorithm: Newton with trust region for simple bound constraints
Cause of termination: Trust region is too small: 1.4901161193847656e-08
Number of iterations: 26
Proportion of Hessian calculation: 1/1 = 100.0%
Optimization time: 0:00:00.999584
Calculate second derivatives and BHHH
It seems that the optimization algorithm did not converge. Therefore, the results may not correspond to the maximum likelihood estimator. Check the specification of the model, or the criteria for convergence of the algorithm.
File b21multiple_models_000001~02.html has been generated.
File b21multiple_models_000001~02.yaml has been generated.
Biogeme parameters provided by the user.
*** Initial values of the parameters are obtained from the file __b21multiple_models_000002.iter
Parameter values restored from __b21multiple_models_000002.iter
Starting values for the algorithm: {'asc_train_ref': 0.30414330566861314, 'asc_train_diff_male': -1.3187537982023305, 'asc_train_diff_GA': 1.9018995482218424, 'b_time': -2.04801569204446, 'b_cost': -3.9535345256538434, 'asc_car_ref': -0.9341705263350313, 'asc_car_diff_male': 1.4503745214341726, 'asc_car_diff_GA': -1.322080076928592}
Optimization algorithm: hybrid Newton/BFGS with simple bounds [simple_bounds]
** Optimization: Newton with trust region for simple bounds
Iter.   asc_train_ref asc_train_diff_ asc_train_diff_          b_time     lambda_time          b_cost     asc_car_ref asc_car_diff_ma asc_car_diff_GA     Function    Relgrad   Radius      Rho
    0             0.3            -1.3             1.9              -2               1              -4           -0.93             1.5            -1.3      1.4e+04       0.27      0.5 -4.3e-05    -
    1             0.3            -1.3             1.9              -2               1              -4           -0.93             1.5            -1.3      1.4e+04       0.27     0.25    0.038    -
    2           0.054            -1.6             2.2            -1.8             1.2            -4.2           -0.68             1.7            -1.1      1.3e+04        0.3     0.25     0.15    +
    3           0.054            -1.6             2.2            -1.8             1.2            -4.2           -0.68             1.7            -1.1      1.3e+04        0.3     0.12    0.022    -
    4           0.054            -1.6             2.2            -1.8             1.2            -4.2           -0.68             1.7            -1.1      1.3e+04        0.3    0.062    0.033    -
    5           0.054            -1.6             2.2            -1.8             1.2            -4.2           -0.68             1.7            -1.1      1.3e+04        0.3    0.031    0.014    -
    6           0.054            -1.6             2.2            -1.8             1.2            -4.2           -0.68             1.7            -1.1      1.3e+04        0.3    0.016    0.093    -
    7            0.07            -1.6             2.2            -1.8             1.3            -4.2           -0.67             1.7            -1.1      1.3e+04        0.3    0.016      0.1    +
    8            0.07            -1.6             2.2            -1.8             1.3            -4.2           -0.67             1.7            -1.1      1.3e+04        0.3   0.0078    0.086    -
    9            0.07            -1.6             2.2            -1.8             1.3            -4.2           -0.67             1.7            -1.1      1.3e+04        0.3   0.0039    0.089    -
   10            0.07            -1.6             2.2            -1.8             1.3            -4.2           -0.67             1.7            -1.1      1.3e+04        0.3    0.002    0.091    -
   11            0.07            -1.6             2.2            -1.8             1.3            -4.2           -0.67             1.7            -1.1      1.3e+04        0.3  0.00098    0.092    -
   12            0.07            -1.6             2.2            -1.8             1.3            -4.2           -0.67             1.7            -1.1      1.3e+04        0.3  0.00049    0.092    -
   13            0.07            -1.6             2.2            -1.8             1.3            -4.2           -0.67             1.7            -1.1      1.3e+04        0.3  0.00024    0.093    -
   14            0.07            -1.6             2.2            -1.8             1.3            -4.2           -0.67             1.7            -1.1      1.3e+04        0.3  0.00012    0.093    -
   15            0.07            -1.6             2.2            -1.8             1.3            -4.2           -0.67             1.7            -1.1      1.3e+04        0.3  6.1e-05    0.093    -
   16            0.07            -1.6             2.2            -1.8             1.3            -4.2           -0.67             1.7            -1.1      1.3e+04        0.3  3.1e-05    0.093    -
   17            0.07            -1.6             2.2            -1.8             1.3            -4.2           -0.67             1.7            -1.1      1.3e+04        0.3  1.5e-05    0.093    -
   18            0.07            -1.6             2.2            -1.8             1.3            -4.2           -0.67             1.7            -1.1      1.3e+04        0.3  7.6e-06    0.093    -
   19            0.07            -1.6             2.2            -1.8             1.3            -4.2           -0.67             1.7            -1.1      1.3e+04        0.3  3.8e-06    0.093    -
   20            0.07            -1.6             2.2            -1.8             1.3            -4.2           -0.67             1.7            -1.1      1.3e+04        0.3  1.9e-06    0.093    -
   21            0.07            -1.6             2.2            -1.8             1.3            -4.2           -0.67             1.7            -1.1      1.3e+04        0.3  9.5e-07    0.093    -
   22            0.07            -1.6             2.2            -1.8             1.3            -4.2           -0.67             1.7            -1.1      1.3e+04        0.3  4.8e-07    0.093    -
   23            0.07            -1.6             2.2            -1.8             1.3            -4.2           -0.67             1.7            -1.1      1.3e+04        0.3  2.4e-07    0.093    -
   24            0.07            -1.6             2.2            -1.8             1.3            -4.2           -0.67             1.7            -1.1      1.3e+04        0.3  1.2e-07    0.093    -
   25            0.07            -1.6             2.2            -1.8             1.3            -4.2           -0.67             1.7            -1.1      1.3e+04        0.3    6e-08    0.093    -
   26            0.07            -1.6             2.2            -1.8             1.3            -4.2           -0.67             1.7            -1.1      1.3e+04        0.3    3e-08    0.093    -
   27            0.07            -1.6             2.2            -1.8             1.3            -4.2           -0.67             1.7            -1.1      1.3e+04        0.3  1.5e-08    0.093    -
Optimization algorithm has *not* converged.
Algorithm: Newton with trust region for simple bound constraints
Cause of termination: Trust region is too small: 1.4901161193847656e-08
Number of iterations: 28
Proportion of Hessian calculation: 3/3 = 100.0%
Optimization time: 0:00:01.961422
Calculate second derivatives and BHHH
It seems that the optimization algorithm did not converge. Therefore, the results may not correspond to the maximum likelihood estimator. Check the specification of the model, or the criteria for convergence of the algorithm.
File b21multiple_models_000002~02.html has been generated.
File b21multiple_models_000002~02.yaml has been generated.
Biogeme parameters provided by the user.
*** Initial values of the parameters are obtained from the file __b21multiple_models_000003.iter
Parameter values restored from __b21multiple_models_000003.iter
Starting values for the algorithm: {'asc_train_ref': 0.12501564761290923, 'asc_train_diff_male': -1.302939379720285, 'asc_train_diff_GA': 1.9430273190823513, 'b_time': -1.8819982158039121, 'lambda_time': 1.0, 'b_cost': -1.8121332737470164, 'asc_car_ref': -0.8012014693839187, 'asc_car_diff_male': 0.8872036748436755, 'asc_car_diff_GA': -0.7764521690057898}
Optimization algorithm: hybrid Newton/BFGS with simple bounds [simple_bounds]
** Optimization: Newton with trust region for simple bounds
Iter.   asc_train_ref asc_train_diff_          b_time     lambda_time          b_cost     asc_car_ref asc_car_diff_GA     Function    Relgrad   Radius      Rho
    0            0.13             1.9            -1.9               1            -1.8            -0.8           -0.78        1e+04       0.63      0.5    0.053    -
    1            0.13             1.9            -1.9               1            -1.8            -0.8           -0.78        1e+04       0.63     0.25    -0.12    -
    2            0.13             1.9            -1.9               1            -1.8            -0.8           -0.78        1e+04       0.63     0.12    0.083    -
    3            0.13             1.9            -1.9               1            -1.8            -0.8           -0.78        1e+04       0.63    0.062    0.077    -
    4            0.13             1.9            -1.9               1            -1.8            -0.8           -0.78        1e+04       0.63    0.031    0.074    -
    5            0.13             1.9            -1.9               1            -1.8            -0.8           -0.78        1e+04       0.63    0.016    0.072    -
    6            0.13             1.9            -1.9               1            -1.8            -0.8           -0.78        1e+04       0.63   0.0078    0.071    -
    7            0.13             1.9            -1.9               1            -1.8            -0.8           -0.78        1e+04       0.63   0.0039    0.071    -
    8            0.13             1.9            -1.9               1            -1.8            -0.8           -0.78        1e+04       0.63    0.002    0.071    -
    9            0.13             1.9            -1.9               1            -1.8            -0.8           -0.78        1e+04       0.63  0.00098     0.07    -
   10            0.13             1.9            -1.9               1            -1.8            -0.8           -0.78        1e+04       0.63  0.00049     0.07    -
   11            0.13             1.9            -1.9               1            -1.8            -0.8           -0.78        1e+04       0.63  0.00024     0.07    -
   12            0.13             1.9            -1.9               1            -1.8            -0.8           -0.78        1e+04       0.63  0.00012     0.07    -
   13            0.13             1.9            -1.9               1            -1.8            -0.8           -0.78        1e+04       0.63  6.1e-05     0.07    -
   14            0.13             1.9            -1.9               1            -1.8            -0.8           -0.78        1e+04       0.63  3.1e-05     0.07    -
   15            0.13             1.9            -1.9               1            -1.8            -0.8           -0.78        1e+04       0.63  1.5e-05     0.07    -
   16            0.13             1.9            -1.9               1            -1.8            -0.8           -0.78        1e+04       0.63  7.6e-06     0.07    -
   17            0.13             1.9            -1.9               1            -1.8            -0.8           -0.78        1e+04       0.63  3.8e-06     0.07    -
   18            0.13             1.9            -1.9               1            -1.8            -0.8           -0.78        1e+04       0.63  1.9e-06     0.07    -
   19            0.13             1.9            -1.9               1            -1.8            -0.8           -0.78        1e+04       0.63  9.5e-07     0.07    -
   20            0.13             1.9            -1.9               1            -1.8            -0.8           -0.78        1e+04       0.63  4.8e-07     0.07    -
   21            0.13             1.9            -1.9               1            -1.8            -0.8           -0.78        1e+04       0.63  2.4e-07     0.07    -
   22            0.13             1.9            -1.9               1            -1.8            -0.8           -0.78        1e+04       0.63  1.2e-07     0.07    -
   23            0.13             1.9            -1.9               1            -1.8            -0.8           -0.78        1e+04       0.63    6e-08     0.07    -
   24            0.13             1.9            -1.9               1            -1.8            -0.8           -0.78        1e+04       0.63    3e-08     0.07    -
   25            0.13             1.9            -1.9               1            -1.8            -0.8           -0.78        1e+04       0.63  1.5e-08     0.07    -
Optimization algorithm has *not* converged.
Algorithm: Newton with trust region for simple bound constraints
Cause of termination: Trust region is too small: 1.4901161193847656e-08
Number of iterations: 26
Proportion of Hessian calculation: 1/1 = 100.0%
Optimization time: 0:00:02.466353
Calculate second derivatives and BHHH
It seems that the optimization algorithm did not converge. Therefore, the results may not correspond to the maximum likelihood estimator. Check the specification of the model, or the criteria for convergence of the algorithm.
File b21multiple_models_000003~02.html has been generated.
File b21multiple_models_000003~02.yaml has been generated.
Biogeme parameters provided by the user.
*** Initial values of the parameters are obtained from the file __b21multiple_models_000004.iter
Parameter values restored from __b21multiple_models_000004.iter
Starting values for the algorithm: {'asc_train_ref': -1.0259779041009203, 'asc_train_diff_GA': 2.0417012426211842, 'b_time': -1.6680444783266624, 'lambda_time': 0.38240549309565697, 'b_cost': -1.0996092635678825, 'asc_car_ref': -0.06404634973454987, 'asc_car_diff_GA': -0.31338244218602307}
Optimization algorithm: hybrid Newton/BFGS with simple bounds [simple_bounds]
** Optimization: Newton with trust region for simple bounds
Iter.       asc_train          b_time          b_cost         asc_car     Function    Relgrad   Radius      Rho
    0               0            -1.7            -1.1               0      5.6e+03       0.19     0.31   -0.071    -
    1               0            -1.7            -1.1               0      5.6e+03       0.19     0.15       -1    -
    2               0            -1.7            -1.1               0      5.6e+03       0.19    0.077    -0.63    -
    3               0            -1.7            -1.1               0      5.6e+03       0.19    0.038    -0.51    -
    4               0            -1.7            -1.1               0      5.6e+03       0.19    0.019    -0.46    -
    5               0            -1.7            -1.1               0      5.6e+03       0.19   0.0096    -0.43    -
    6               0            -1.7            -1.1               0      5.6e+03       0.19   0.0048    -0.42    -
    7               0            -1.7            -1.1               0      5.6e+03       0.19   0.0024    -0.42    -
    8               0            -1.7            -1.1               0      5.6e+03       0.19   0.0012    -0.41    -
    9               0            -1.7            -1.1               0      5.6e+03       0.19   0.0006    -0.41    -
   10               0            -1.7            -1.1               0      5.6e+03       0.19   0.0003    -0.41    -
   11               0            -1.7            -1.1               0      5.6e+03       0.19  0.00015    -0.41    -
   12               0            -1.7            -1.1               0      5.6e+03       0.19  7.5e-05    -0.41    -
   13               0            -1.7            -1.1               0      5.6e+03       0.19  3.7e-05    -0.41    -
   14               0            -1.7            -1.1               0      5.6e+03       0.19  1.9e-05    -0.41    -
   15               0            -1.7            -1.1               0      5.6e+03       0.19  9.4e-06    -0.41    -
   16               0            -1.7            -1.1               0      5.6e+03       0.19  4.7e-06    -0.41    -
   17               0            -1.7            -1.1               0      5.6e+03       0.19  2.3e-06    -0.41    -
   18               0            -1.7            -1.1               0      5.6e+03       0.19  1.2e-06    -0.41    -
   19               0            -1.7            -1.1               0      5.6e+03       0.19  5.9e-07    -0.41    -
   20               0            -1.7            -1.1               0      5.6e+03       0.19  2.9e-07    -0.41    -
   21               0            -1.7            -1.1               0      5.6e+03       0.19  1.5e-07    -0.41    -
   22               0            -1.7            -1.1               0      5.6e+03       0.19  7.3e-08    -0.41    -
   23               0            -1.7            -1.1               0      5.6e+03       0.19  3.7e-08    -0.41    -
   24               0            -1.7            -1.1               0      5.6e+03       0.19  1.8e-08    -0.41    -
   25               0            -1.7            -1.1               0      5.6e+03       0.19  9.2e-09    -0.41    -
Optimization algorithm has *not* converged.
Algorithm: Newton with trust region for simple bound constraints
Cause of termination: Trust region is too small: 9.150825283785798e-09
Number of iterations: 26
Proportion of Hessian calculation: 1/1 = 100.0%
Optimization time: 0:00:00.676791
Calculate second derivatives and BHHH
It seems that the optimization algorithm did not converge. Therefore, the results may not correspond to the maximum likelihood estimator. Check the specification of the model, or the criteria for convergence of the algorithm.
File b21multiple_models_000004~02.html has been generated.
File b21multiple_models_000004~02.yaml has been generated.
Biogeme parameters provided by the user.
*** Initial values of the parameters are obtained from the file __b21multiple_models_000005.iter
Parameter values restored from __b21multiple_models_000005.iter
Starting values for the algorithm: {'asc_train': -0.6658090303657527, 'b_time': -1.7943071717024797, 'b_cost': -2.05346032485426, 'asc_car': -0.1396811217297752}
Optimization algorithm: hybrid Newton/BFGS with simple bounds [simple_bounds]
** Optimization: Newton with trust region for simple bounds
Iter.   asc_train_ref asc_train_diff_ asc_train_diff_          b_time     lambda_time      b_cost_ref b_cost_diff_inc b_cost_diff_inc b_cost_diff_inc b_cost_diff_inc     asc_car_ref asc_car_diff_ma asc_car_diff_GA     Function    Relgrad   Radius      Rho
    0              -1           -0.82           0.012            -2.7             1.1           -0.15          -0.015           -0.06          -0.059         -0.0064          -0.086          -0.056          -0.066      7.6e+03       0.47        1     0.44    +
    1            -1.8            -1.5            0.69            -3.5             1.7            -1.1           -0.12            -0.4           -0.49          -0.048           -0.27           -0.11           -0.33      6.4e+03       0.34        1      0.5    +
    2            -1.8            -1.5            0.69            -3.5             1.7            -1.1           -0.12            -0.4           -0.49          -0.048           -0.27           -0.11           -0.33      6.4e+03       0.34      0.5       -1    -
    3            -2.3              -2            0.71            -3.9             1.8            -1.2           -0.12           -0.41            -0.5           -0.04          -0.075            0.05           -0.34      6.2e+03       0.32      0.5     0.26    +
    4            -2.3              -2            0.71            -3.9             1.8            -1.2           -0.12           -0.41            -0.5           -0.04          -0.075            0.05           -0.34      6.2e+03       0.32     0.25   -0.026    -
    5            -2.3              -2            0.71            -3.9             1.8            -1.2           -0.12           -0.41            -0.5           -0.04          -0.075            0.05           -0.34      6.2e+03       0.32     0.12    -0.19    -
    6            -2.3              -2            0.71            -3.9             1.8            -1.2           -0.12           -0.41            -0.5           -0.04          -0.075            0.05           -0.34      6.2e+03       0.32    0.062    -0.11    -
    7            -2.3              -2            0.71            -3.9             1.8            -1.2           -0.12           -0.41            -0.5           -0.04          -0.075            0.05           -0.34      6.2e+03       0.32    0.031   -0.086    -
    8            -2.3              -2            0.71            -3.9             1.8            -1.2           -0.12           -0.41            -0.5           -0.04          -0.075            0.05           -0.34      6.2e+03       0.32    0.016   -0.074    -
    9            -2.3              -2            0.71            -3.9             1.8            -1.2           -0.12           -0.41            -0.5           -0.04          -0.075            0.05           -0.34      6.2e+03       0.32   0.0078   -0.069    -
   10            -2.3              -2            0.71            -3.9             1.8            -1.2           -0.12           -0.41            -0.5           -0.04          -0.075            0.05           -0.34      6.2e+03       0.32   0.0039   -0.066    -
   11            -2.3              -2            0.71            -3.9             1.8            -1.2           -0.12           -0.41            -0.5           -0.04          -0.075            0.05           -0.34      6.2e+03       0.32    0.002   -0.065    -
   12            -2.3              -2            0.71            -3.9             1.8            -1.2           -0.12           -0.41            -0.5           -0.04          -0.075            0.05           -0.34      6.2e+03       0.32  0.00098   -0.064    -
   13            -2.3              -2            0.71            -3.9             1.8            -1.2           -0.12           -0.41            -0.5           -0.04          -0.075            0.05           -0.34      6.2e+03       0.32  0.00049   -0.064    -
   14            -2.3              -2            0.71            -3.9             1.8            -1.2           -0.12           -0.41            -0.5           -0.04          -0.075            0.05           -0.34      6.2e+03       0.32  0.00024   -0.064    -
   15            -2.3              -2            0.71            -3.9             1.8            -1.2           -0.12           -0.41            -0.5           -0.04          -0.075            0.05           -0.34      6.2e+03       0.32  0.00012   -0.064    -
   16            -2.3              -2            0.71            -3.9             1.8            -1.2           -0.12           -0.41            -0.5           -0.04          -0.075            0.05           -0.34      6.2e+03       0.32  6.1e-05   -0.064    -
   17            -2.3              -2            0.71            -3.9             1.8            -1.2           -0.12           -0.41            -0.5           -0.04          -0.075            0.05           -0.34      6.2e+03       0.32  3.1e-05   -0.064    -
   18            -2.3              -2            0.71            -3.9             1.8            -1.2           -0.12           -0.41            -0.5           -0.04          -0.075            0.05           -0.34      6.2e+03       0.32  1.5e-05   -0.064    -
   19            -2.3              -2            0.71            -3.9             1.8            -1.2           -0.12           -0.41            -0.5           -0.04          -0.075            0.05           -0.34      6.2e+03       0.32  7.6e-06   -0.064    -
   20            -2.3              -2            0.71            -3.9             1.8            -1.2           -0.12           -0.41            -0.5           -0.04          -0.075            0.05           -0.34      6.2e+03       0.32  3.8e-06   -0.064    -
   21            -2.3              -2            0.71            -3.9             1.8            -1.2           -0.12           -0.41            -0.5           -0.04          -0.075            0.05           -0.34      6.2e+03       0.32  1.9e-06   -0.064    -
   22            -2.3              -2            0.71            -3.9             1.8            -1.2           -0.12           -0.41            -0.5           -0.04          -0.075            0.05           -0.34      6.2e+03       0.32  9.5e-07   -0.064    -
   23            -2.3              -2            0.71            -3.9             1.8            -1.2           -0.12           -0.41            -0.5           -0.04          -0.075            0.05           -0.34      6.2e+03       0.32  4.8e-07   -0.064    -
   24            -2.3              -2            0.71            -3.9             1.8            -1.2           -0.12           -0.41            -0.5           -0.04          -0.075            0.05           -0.34      6.2e+03       0.32  2.4e-07   -0.064    -
   25            -2.3              -2            0.71            -3.9             1.8            -1.2           -0.12           -0.41            -0.5           -0.04          -0.075            0.05           -0.34      6.2e+03       0.32  1.2e-07   -0.064    -
   26            -2.3              -2            0.71            -3.9             1.8            -1.2           -0.12           -0.41            -0.5           -0.04          -0.075            0.05           -0.34      6.2e+03       0.32    6e-08   -0.064    -
   27            -2.3              -2            0.71            -3.9             1.8            -1.2           -0.12           -0.41            -0.5           -0.04          -0.075            0.05           -0.34      6.2e+03       0.32    3e-08   -0.064    -
   28            -2.3              -2            0.71            -3.9             1.8            -1.2           -0.12           -0.41            -0.5           -0.04          -0.075            0.05           -0.34      6.2e+03       0.32  1.5e-08   -0.064    -
Optimization algorithm has *not* converged.
Algorithm: Newton with trust region for simple bound constraints
Cause of termination: Trust region is too small: 1.4901161193847656e-08
Number of iterations: 29
Proportion of Hessian calculation: 4/4 = 100.0%
Optimization time: 0:00:02.496281
Calculate second derivatives and BHHH
It seems that the optimization algorithm did not converge. Therefore, the results may not correspond to the maximum likelihood estimator. Check the specification of the model, or the criteria for convergence of the algorithm.
File b21multiple_models_000005~02.html has been generated.
File b21multiple_models_000005~02.yaml has been generated.
Biogeme parameters provided by the user.
*** Initial values of the parameters are obtained from the file __b21multiple_models_000006.iter
Parameter values restored from __b21multiple_models_000006.iter
Starting values for the algorithm: {'asc_train_ref': -0.04603848211226648, 'asc_train_diff_male': -1.0581733354280753, 'asc_train_diff_GA': 2.0007461531550437, 'b_time': -2.072439947873135, 'lambda_time': 0.3575588455412595, 'b_cost_ref': -0.5905893778938438, 'b_cost_diff_inc-under50': -0.151898965754853, 'b_cost_diff_inc-50-100': -0.3970372284753249, 'b_cost_diff_inc-100+': 0.640625, 'b_cost_diff_inc-unknown': 0.07330932171179541, 'asc_car_ref': -0.9684815088944665, 'asc_car_diff_male': -0.06460629052080649, 'asc_car_diff_GA': -1.2646207341033537}
Optimization algorithm: hybrid Newton/BFGS with simple bounds [simple_bounds]
** Optimization: Newton with trust region for simple bounds
Iter.   asc_train_ref asc_train_diff_          b_time          b_cost     asc_car_ref asc_car_diff_GA     Function    Relgrad   Radius      Rho
    0           -0.81             2.8            -2.7           -0.82           0.032            -1.3        7e+03       0.15        1      0.4    +
    1           -0.81             2.8            -2.7           -0.82           0.032            -1.3        7e+03       0.15      0.5     -0.4    -
    2           -0.81             2.8            -2.7           -0.82           0.032            -1.3        7e+03       0.15     0.25   -0.042    -
    3           -0.81             2.8            -2.7           -0.82           0.032            -1.3        7e+03       0.15     0.12    0.046    -
    4           -0.93             2.9            -2.6           -0.95            0.16            -1.1      6.9e+03       0.15     0.12     0.11    +
    5           -0.93             2.9            -2.6           -0.95            0.16            -1.1      6.9e+03       0.15    0.062    0.063    -
    6           -0.93             2.9            -2.6           -0.95            0.16            -1.1      6.9e+03       0.15    0.031    0.073    -
    7           -0.93             2.9            -2.6           -0.95            0.16            -1.1      6.9e+03       0.15    0.016    0.074    -
    8           -0.93             2.9            -2.6           -0.95            0.16            -1.1      6.9e+03       0.15   0.0078    0.074    -
    9           -0.93             2.9            -2.6           -0.95            0.16            -1.1      6.9e+03       0.15   0.0039    0.075    -
   10           -0.93             2.9            -2.6           -0.95            0.16            -1.1      6.9e+03       0.15    0.002    0.075    -
   11           -0.93             2.9            -2.6           -0.95            0.16            -1.1      6.9e+03       0.15  0.00098    0.075    -
   12           -0.93             2.9            -2.6           -0.95            0.16            -1.1      6.9e+03       0.15  0.00049    0.075    -
   13           -0.93             2.9            -2.6           -0.95            0.16            -1.1      6.9e+03       0.15  0.00024    0.075    -
   14           -0.93             2.9            -2.6           -0.95            0.16            -1.1      6.9e+03       0.15  0.00012    0.075    -
   15           -0.93             2.9            -2.6           -0.95            0.16            -1.1      6.9e+03       0.15  6.1e-05    0.075    -
   16           -0.93             2.9            -2.6           -0.95            0.16            -1.1      6.9e+03       0.15  3.1e-05    0.075    -
   17           -0.93             2.9            -2.6           -0.95            0.16            -1.1      6.9e+03       0.15  1.5e-05    0.075    -
   18           -0.93             2.9            -2.6           -0.95            0.16            -1.1      6.9e+03       0.15  7.6e-06    0.075    -
   19           -0.93             2.9            -2.6           -0.95            0.16            -1.1      6.9e+03       0.15  3.8e-06    0.075    -
   20           -0.93             2.9            -2.6           -0.95            0.16            -1.1      6.9e+03       0.15  1.9e-06    0.075    -
   21           -0.93             2.9            -2.6           -0.95            0.16            -1.1      6.9e+03       0.15  9.5e-07    0.075    -
   22           -0.93             2.9            -2.6           -0.95            0.16            -1.1      6.9e+03       0.15  4.8e-07    0.075    -
   23           -0.93             2.9            -2.6           -0.95            0.16            -1.1      6.9e+03       0.15  2.4e-07    0.075    -
   24           -0.93             2.9            -2.6           -0.95            0.16            -1.1      6.9e+03       0.15  1.2e-07    0.075    -
   25           -0.93             2.9            -2.6           -0.95            0.16            -1.1      6.9e+03       0.15    6e-08    0.075    -
   26           -0.93             2.9            -2.6           -0.95            0.16            -1.1      6.9e+03       0.15    3e-08    0.075    -
   27           -0.93             2.9            -2.6           -0.95            0.16            -1.1      6.9e+03       0.15  1.5e-08    0.075    -
Optimization algorithm has *not* converged.
Algorithm: Newton with trust region for simple bound constraints
Cause of termination: Trust region is too small: 1.4901161193847656e-08
Number of iterations: 28
Proportion of Hessian calculation: 3/3 = 100.0%
Optimization time: 0:00:00.743461
Calculate second derivatives and BHHH
It seems that the optimization algorithm did not converge. Therefore, the results may not correspond to the maximum likelihood estimator. Check the specification of the model, or the criteria for convergence of the algorithm.
File b21multiple_models_000006~02.html has been generated.
File b21multiple_models_000006~02.yaml has been generated.
Biogeme parameters provided by the user.
*** Initial values of the parameters are obtained from the file __b21multiple_models_000007.iter
Parameter values restored from __b21multiple_models_000007.iter
Starting values for the algorithm: {'asc_train': -0.7011872849436401, 'b_time': -1.2778589565196719, 'lambda_time': 1.0, 'b_cost': -1.0837900371207714, 'asc_car': -0.15463267198926273}
Optimization algorithm: hybrid Newton/BFGS with simple bounds [simple_bounds]
** Optimization: Newton with trust region for simple bounds
Iter.       asc_train          b_time     lambda_time          b_cost         asc_car     Function    Relgrad   Radius      Rho
    0           -0.34            -1.9            0.35            -1.1           0.088      5.3e+03      0.012        1     0.66    +
    1           -0.48            -1.7            0.49            -1.1          0.0013      5.3e+03     0.0017       10      1.1   ++
    2           -0.48            -1.7            0.51            -1.1         -0.0044      5.3e+03    3.6e-05    1e+02        1   ++
    3           -0.48            -1.7            0.51            -1.1         -0.0044      5.3e+03    6.9e-09    1e+02        1   ++
Optimization algorithm has converged.
Relative gradient: 6.862266118636937e-09
Cause of termination: Relative gradient = 6.9e-09 <= 6.1e-06
Number of function evaluations: 13
Number of gradient evaluations: 9
Number of hessian evaluations: 4
Algorithm: Newton with trust region for simple bound constraints
Number of iterations: 4
Proportion of Hessian calculation: 4/4 = 100.0%
Optimization time: 0:00:01.874373
Calculate second derivatives and BHHH
File b21multiple_models_000007~02.html has been generated.
File b21multiple_models_000007~02.yaml has been generated.
summary, description = compile_estimation_results(all_results, use_short_names=True)
print(summary)
                                     Model_000000  ...         Model_000007
Number of estimated parameters                 10  ...                    5
Sample size                                  6768  ...                 6768
Final log likelihood                    -4879.461  ...            -5292.095
Akaike Information Criterion             9778.922  ...             10594.19
Bayesian Information Criterion           9847.122  ...             10628.29
asc_train_ref (t-test)             -0.22  (-2.44)  ...
asc_train_diff_male (t-test)       -1.15  (-13.4)  ...
asc_train_diff_GA (t-test)           1.96  (21.2)  ...
b_time (t-test)                     -1.7  (-21.3)  ...       -1.67  (-21.9)
lambda_time (t-test)                0.334  (4.55)  ...          0.51  (6.6)
b_cost_ref (t-test)                 -1.1  (-15.1)  ...
b_cost_diff_GA (t-test)             0.915  (1.85)  ...
asc_car_ref (t-test)              -0.422  (-4.29)  ...
asc_car_diff_male (t-test)          0.413  (3.95)  ...
asc_car_diff_GA (t-test)           -1.03  (-2.56)  ...
b_cost (t-test)                                    ...       -1.08  (-15.9)
asc_train (t-test)                                 ...      -0.485  (-7.53)
asc_car (t-test)                                   ...  -0.00462  (-0.0963)
b_cost_diff_inc-under50 (t-test)                   ...
b_cost_diff_inc-50-100 (t-test)                    ...
b_cost_diff_inc-100+ (t-test)                      ...
b_cost_diff_inc-unknown (t-test)                   ...

[22 rows x 8 columns]
print(f'Summary table available in {CSV_FILE}')
summary.to_csv(CSV_FILE, sep=SEP_CSV)
Summary table available in b21process_pareto.csv

Explanation of the short names of the models.

with open(CSV_FILE, 'a', encoding='utf-8') as f:
    print('\n\n', file=f)
    for k, v in description.items():
        if k != v:
            print(f'{k}: {v}')
            print(f'{k}{SEP_CSV}{v}', file=f)
Model_000000: asc:MALE-GA;b_cost:GA;train_tt:boxcox
Model_000001: asc:MALE-GA;b_cost:no_seg;train_tt:log
Model_000002: asc:MALE-GA;b_cost:no_seg;train_tt:boxcox
Model_000003: asc:GA;b_cost:no_seg;train_tt:boxcox
Model_000004: asc:no_seg;b_cost:no_seg;train_tt:linear
Model_000005: asc:MALE-GA;b_cost:INCOME;train_tt:boxcox
Model_000006: asc:GA;b_cost:no_seg;train_tt:log
Model_000007: asc:no_seg;b_cost:no_seg;train_tt:boxcox

The following plot illustrates all models that have been estimated. Each dot corresponds to a model. The x-coordinate corresponds to the negative log-likelihood. The y-coordinate corresponds to the number of parameters. If the shape of the dot is a circle, it means that it corresponds to a Pareto optimal model. If the shape is a cross, it means that the model has been Pareto optimal at some point during the algorithm and later removed as a new model dominating it has been found.

if can_plot:
    try:
        _ = the_pareto_post.plot(
            label_x='Negative loglikelihood', label_y='Number of parameters'
        )
        plt.show()
    except OptimizationError as e:
        print(f'No plot available: {e}')
plot b21process pareto

Total running time of the script: (0 minutes 27.985 seconds)

Gallery generated by Sphinx-Gallery