Note
Go to the end to download the full example code.
21c. 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 21b. 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_b21b_multiple_models_spec import the_biogeme, PARETO_FILE_NAME
PATH_PARETO_FILE_NAME = f'saved_results/{PARETO_FILE_NAME}'
logger = blog.get_screen_logger(blog.INFO)
logger.info('Example b21c_process_pareto.py')
CSV_FILE = 'b21_process_pareto.csv'
SEP_CSV = ','
Example b21c_process_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=PATH_PARETO_FILE_NAME,
)
Pareto set initialized from file with 36 elements [8 Pareto] and 0 invalid elements.
the_pareto_post.log_statistics()
Pareto: 8
Considered: 36
Removed: 5
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 __b21_multiple_models_000000.iter
Parameter values restored from __b21_multiple_models_000000.iter
Starting values for the algorithm: {'asc_train': -0.48497306751082847, 'b_time': -1.6749097004118856, 'lambda_time': 0.5100585118642703, 'b_cost': -1.0785345256538428, 'asc_car': -0.004623351582876547}
Analytical Hessian method: full
As the model is not too complex, we activate the calculation of second derivatives. To change this behavior, modify the algorithm to "simple_bounds" in the TOML file.
Optimization algorithm: hybrid Newton/BFGS with simple bounds [simple_bounds]
** Optimization: Newton with trust region for simple bounds
Optimization algorithm has converged.
Relative gradient: 2.367865132130195e-09
Cause of termination: Relative gradient = 2.4e-09 <= 6.1e-06
Number of function evaluations: 1
Number of gradient evaluations: 1
Number of hessian evaluations: 0
Algorithm: Newton with trust region for simple bound constraints
Number of iterations: 0
Optimization time: 0:00:00.204035
Calculate final gradient and BHHH
Calculate second derivatives
Biogeme parameters provided by the user.
*** Initial values of the parameters are obtained from the file __b21_multiple_models_000001.iter
Parameter values restored from __b21_multiple_models_000001.iter
Starting values for the algorithm: {'asc_train': -0.7011872849436406, 'b_time': -1.2778589565196712, 'b_cost': -1.083790037120771, 'asc_car': -0.15463267198926292}
Analytical Hessian method: full
As the model is not too complex, we activate the calculation of second derivatives. To change this behavior, modify the algorithm to "simple_bounds" in the TOML file.
Optimization algorithm: hybrid Newton/BFGS with simple bounds [simple_bounds]
** Optimization: Newton with trust region for simple bounds
Optimization algorithm has converged.
Relative gradient: 1.3841917138444102e-07
Cause of termination: Relative gradient = 1.4e-07 <= 6.1e-06
Number of function evaluations: 1
Number of gradient evaluations: 1
Number of hessian evaluations: 0
Algorithm: Newton with trust region for simple bound constraints
Number of iterations: 0
Optimization time: 0:00:00.194494
Calculate final gradient and BHHH
Calculate second derivatives
Biogeme parameters provided by the user.
*** Initial values of the parameters are obtained from the file __b21_multiple_models_000002.iter
Parameter values restored from __b21_multiple_models_000002.iter
Starting values for the algorithm: {'asc_train_ref': -0.20264549785499558, 'asc_train_diff_male': -1.200728418470046, 'asc_train_diff_GA': 2.027138762017538, 'b_time': -1.7020556248823198, 'b_cost': -1.0632584808816534, 'asc_car_ref': -0.38890294740134795, 'asc_car_diff_male': 0.3766698739403544, 'asc_car_diff_GA': -0.41534549213148914}
Analytical Hessian method: full
As the model is not too complex, we activate the calculation of second derivatives. To change this behavior, modify the algorithm to "simple_bounds" in the TOML file.
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 -1.2 2.1 -2.7 0.46 -0.88 -0.42 -0.43 7.2e+03 0.43 1 0.78 +
1 -1.2 2.1 -2.7 0.46 -0.88 -0.42 -0.43 7.2e+03 0.43 0.5 -0.28 -
2 -1.6 2.5 -3.2 0.13 -0.69 -0.92 -0.48 6.9e+03 0.2 0.5 0.43 +
3 -1.6 2.5 -3.2 0.13 -0.69 -0.92 -0.48 6.9e+03 0.2 0.25 -0.016 -
4 -1.5 2.8 -3.5 -0.12 -0.91 -0.81 -0.59 6.9e+03 0.14 0.25 0.22 +
5 -1.5 2.8 -3.5 -0.12 -0.91 -0.81 -0.59 6.9e+03 0.14 0.12 -1.3 -
6 -1.5 2.8 -3.5 -0.12 -0.91 -0.81 -0.59 6.9e+03 0.14 0.062 -0.95 -
7 -1.5 2.8 -3.5 -0.12 -0.91 -0.81 -0.59 6.9e+03 0.14 0.031 -0.75 -
8 -1.5 2.8 -3.5 -0.12 -0.91 -0.81 -0.59 6.9e+03 0.14 0.016 -0.64 -
9 -1.5 2.8 -3.5 -0.12 -0.91 -0.81 -0.59 6.9e+03 0.14 0.0078 -0.59 -
10 -1.5 2.8 -3.5 -0.12 -0.91 -0.81 -0.59 6.9e+03 0.14 0.0039 -0.57 -
11 -1.5 2.8 -3.5 -0.12 -0.91 -0.81 -0.59 6.9e+03 0.14 0.002 -0.55 -
12 -1.5 2.8 -3.5 -0.12 -0.91 -0.81 -0.59 6.9e+03 0.14 0.00098 -0.55 -
13 -1.5 2.8 -3.5 -0.12 -0.91 -0.81 -0.59 6.9e+03 0.14 0.00049 -0.54 -
14 -1.5 2.8 -3.5 -0.12 -0.91 -0.81 -0.59 6.9e+03 0.14 0.00024 -0.54 -
15 -1.5 2.8 -3.5 -0.12 -0.91 -0.81 -0.59 6.9e+03 0.14 0.00012 -0.54 -
16 -1.5 2.8 -3.5 -0.12 -0.91 -0.81 -0.59 6.9e+03 0.14 6.1e-05 -0.54 -
17 -1.5 2.8 -3.5 -0.12 -0.91 -0.81 -0.59 6.9e+03 0.14 3.1e-05 -0.54 -
18 -1.5 2.8 -3.5 -0.12 -0.91 -0.81 -0.59 6.9e+03 0.14 1.5e-05 -0.54 -
19 -1.5 2.8 -3.5 -0.12 -0.91 -0.81 -0.59 6.9e+03 0.14 7.6e-06 -0.54 -
20 -1.5 2.8 -3.5 -0.12 -0.91 -0.81 -0.59 6.9e+03 0.14 3.8e-06 -0.54 -
21 -1.5 2.8 -3.5 -0.12 -0.91 -0.81 -0.59 6.9e+03 0.14 1.9e-06 -0.54 -
22 -1.5 2.8 -3.5 -0.12 -0.91 -0.81 -0.59 6.9e+03 0.14 9.5e-07 -0.54 -
23 -1.5 2.8 -3.5 -0.12 -0.91 -0.81 -0.59 6.9e+03 0.14 4.8e-07 -0.54 -
24 -1.5 2.8 -3.5 -0.12 -0.91 -0.81 -0.59 6.9e+03 0.14 2.4e-07 -0.54 -
25 -1.5 2.8 -3.5 -0.12 -0.91 -0.81 -0.59 6.9e+03 0.14 1.2e-07 -0.54 -
26 -1.5 2.8 -3.5 -0.12 -0.91 -0.81 -0.59 6.9e+03 0.14 6e-08 -0.54 -
27 -1.5 2.8 -3.5 -0.12 -0.91 -0.81 -0.59 6.9e+03 0.14 3e-08 -0.54 -
28 -1.5 2.8 -3.5 -0.12 -0.91 -0.81 -0.59 6.9e+03 0.14 1.5e-08 -0.54 -
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:04.742609
Calculate final gradient and BHHH
Calculate second derivatives
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.
Biogeme parameters provided by the user.
*** Initial values of the parameters are obtained from the file __b21_multiple_models_000003.iter
Parameter values restored from __b21_multiple_models_000003.iter
Starting values for the algorithm: {'asc_train_ref': -1.0506235695550208, 'asc_train_diff_GA': 2.126084650203615, 'b_time': -1.6770223717911181, 'b_cost': -1.0704947507024756, 'asc_car_ref': -0.06463269501694303, 'asc_car_diff_GA': -0.2677822135309631}
Analytical Hessian method: full
As the model is not too complex, we activate the calculation of second derivatives. To change this behavior, modify the algorithm to "simple_bounds" in the TOML file.
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 -1.9 -0.77 2.1 -2.7 -0.83 -0.098 0.0057 -0.27 8.8e+03 0.51 1 0.21 +
1 -1.9 -0.77 2.1 -2.7 -0.83 -0.098 0.0057 -0.27 8.8e+03 0.51 0.5 -1.2 -
2 -1.9 -0.77 2.1 -2.7 -0.83 -0.098 0.0057 -0.27 8.8e+03 0.51 0.25 -0.54 -
3 -1.9 -0.77 2.1 -2.7 -0.83 -0.098 0.0057 -0.27 8.8e+03 0.51 0.12 -0.29 -
4 -1.9 -0.77 2.1 -2.7 -0.83 -0.098 0.0057 -0.27 8.8e+03 0.51 0.062 -0.23 -
5 -1.9 -0.77 2.1 -2.7 -0.83 -0.098 0.0057 -0.27 8.8e+03 0.51 0.031 -0.2 -
6 -1.9 -0.77 2.1 -2.7 -0.83 -0.098 0.0057 -0.27 8.8e+03 0.51 0.016 -0.19 -
7 -1.9 -0.77 2.1 -2.7 -0.83 -0.098 0.0057 -0.27 8.8e+03 0.51 0.0078 -0.18 -
8 -1.9 -0.77 2.1 -2.7 -0.83 -0.098 0.0057 -0.27 8.8e+03 0.51 0.0039 -0.18 -
9 -1.9 -0.77 2.1 -2.7 -0.83 -0.098 0.0057 -0.27 8.8e+03 0.51 0.002 -0.18 -
10 -1.9 -0.77 2.1 -2.7 -0.83 -0.098 0.0057 -0.27 8.8e+03 0.51 0.00098 -0.18 -
11 -1.9 -0.77 2.1 -2.7 -0.83 -0.098 0.0057 -0.27 8.8e+03 0.51 0.00049 -0.18 -
12 -1.9 -0.77 2.1 -2.7 -0.83 -0.098 0.0057 -0.27 8.8e+03 0.51 0.00024 -0.18 -
13 -1.9 -0.77 2.1 -2.7 -0.83 -0.098 0.0057 -0.27 8.8e+03 0.51 0.00012 -0.18 -
14 -1.9 -0.77 2.1 -2.7 -0.83 -0.098 0.0057 -0.27 8.8e+03 0.51 6.1e-05 -0.18 -
15 -1.9 -0.77 2.1 -2.7 -0.83 -0.098 0.0057 -0.27 8.8e+03 0.51 3.1e-05 -0.18 -
16 -1.9 -0.77 2.1 -2.7 -0.83 -0.098 0.0057 -0.27 8.8e+03 0.51 1.5e-05 -0.18 -
17 -1.9 -0.77 2.1 -2.7 -0.83 -0.098 0.0057 -0.27 8.8e+03 0.51 7.6e-06 -0.18 -
18 -1.9 -0.77 2.1 -2.7 -0.83 -0.098 0.0057 -0.27 8.8e+03 0.51 3.8e-06 -0.18 -
19 -1.9 -0.77 2.1 -2.7 -0.83 -0.098 0.0057 -0.27 8.8e+03 0.51 1.9e-06 -0.18 -
20 -1.9 -0.77 2.1 -2.7 -0.83 -0.098 0.0057 -0.27 8.8e+03 0.51 9.5e-07 -0.18 -
21 -1.9 -0.77 2.1 -2.7 -0.83 -0.098 0.0057 -0.27 8.8e+03 0.51 4.8e-07 -0.18 -
22 -1.9 -0.77 2.1 -2.7 -0.83 -0.098 0.0057 -0.27 8.8e+03 0.51 2.4e-07 -0.18 -
23 -1.9 -0.77 2.1 -2.7 -0.83 -0.098 0.0057 -0.27 8.8e+03 0.51 1.2e-07 -0.18 -
24 -1.9 -0.77 2.1 -2.7 -0.83 -0.098 0.0057 -0.27 8.8e+03 0.51 6e-08 -0.18 -
25 -1.9 -0.77 2.1 -2.7 -0.83 -0.098 0.0057 -0.27 8.8e+03 0.51 3e-08 -0.18 -
26 -1.9 -0.77 2.1 -2.7 -0.83 -0.098 0.0057 -0.27 8.8e+03 0.51 1.5e-08 -0.18 -
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: 27
Proportion of Hessian calculation: 2/2 = 100.0%
Optimization time: 0:00:01.765358
Calculate final gradient and BHHH
Calculate second derivatives
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.
Biogeme parameters provided by the user.
*** Initial values of the parameters are obtained from the file __b21_multiple_models_000004.iter
Parameter values restored from __b21_multiple_models_000004.iter
Starting values for the algorithm: {'asc_train_ref': -1.0259779041009203, 'asc_train_diff_GA': 2.0417012426211842, 'b_time': -1.6680444783266626, 'lambda_time': 0.38240549309565697, 'b_cost': -1.0996092635678825, 'asc_car_ref': -0.06404634973454974, 'asc_car_diff_GA': -0.3133824421860232}
Analytical Hessian method: full
As the model is not too complex, we activate the calculation of second derivatives. To change this behavior, modify the algorithm to "simple_bounds" in the TOML file.
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 2 -1.7 0.38 0 0 0 0 0 -0.064 0 -0.31 1.2e+04 0.51 0.5 -1.3 -
1 -1 0 2 -1.7 0.38 0 0 0 0 0 -0.064 0 -0.31 1.2e+04 0.51 0.25 0.038 -
2 -1.3 -0.25 1.8 -1.9 0.63 -0.16 -0.12 -0.17 0.094 0.017 -0.31 -0.25 -0.56 1.1e+04 0.63 0.25 0.27 +
3 -1.3 -0.25 1.8 -1.9 0.63 -0.16 -0.12 -0.17 0.094 0.017 -0.31 -0.25 -0.56 1.1e+04 0.63 0.12 -0.6 -
4 -1.3 -0.25 1.8 -1.9 0.63 -0.16 -0.12 -0.17 0.094 0.017 -0.31 -0.25 -0.56 1.1e+04 0.63 0.062 -0.48 -
5 -1.3 -0.25 1.8 -1.9 0.63 -0.16 -0.12 -0.17 0.094 0.017 -0.31 -0.25 -0.56 1.1e+04 0.63 0.031 -0.43 -
6 -1.3 -0.25 1.8 -1.9 0.63 -0.16 -0.12 -0.17 0.094 0.017 -0.31 -0.25 -0.56 1.1e+04 0.63 0.016 -0.41 -
7 -1.3 -0.25 1.8 -1.9 0.63 -0.16 -0.12 -0.17 0.094 0.017 -0.31 -0.25 -0.56 1.1e+04 0.63 0.0078 -0.4 -
8 -1.3 -0.25 1.8 -1.9 0.63 -0.16 -0.12 -0.17 0.094 0.017 -0.31 -0.25 -0.56 1.1e+04 0.63 0.0039 -0.39 -
9 -1.3 -0.25 1.8 -1.9 0.63 -0.16 -0.12 -0.17 0.094 0.017 -0.31 -0.25 -0.56 1.1e+04 0.63 0.002 -0.39 -
10 -1.3 -0.25 1.8 -1.9 0.63 -0.16 -0.12 -0.17 0.094 0.017 -0.31 -0.25 -0.56 1.1e+04 0.63 0.00098 -0.39 -
11 -1.3 -0.25 1.8 -1.9 0.63 -0.16 -0.12 -0.17 0.094 0.017 -0.31 -0.25 -0.56 1.1e+04 0.63 0.00049 -0.39 -
12 -1.3 -0.25 1.8 -1.9 0.63 -0.16 -0.12 -0.17 0.094 0.017 -0.31 -0.25 -0.56 1.1e+04 0.63 0.00024 -0.39 -
13 -1.3 -0.25 1.8 -1.9 0.63 -0.16 -0.12 -0.17 0.094 0.017 -0.31 -0.25 -0.56 1.1e+04 0.63 0.00012 -0.38 -
14 -1.3 -0.25 1.8 -1.9 0.63 -0.16 -0.12 -0.17 0.094 0.017 -0.31 -0.25 -0.56 1.1e+04 0.63 6.1e-05 -0.38 -
15 -1.3 -0.25 1.8 -1.9 0.63 -0.16 -0.12 -0.17 0.094 0.017 -0.31 -0.25 -0.56 1.1e+04 0.63 3.1e-05 -0.38 -
16 -1.3 -0.25 1.8 -1.9 0.63 -0.16 -0.12 -0.17 0.094 0.017 -0.31 -0.25 -0.56 1.1e+04 0.63 1.5e-05 -0.38 -
17 -1.3 -0.25 1.8 -1.9 0.63 -0.16 -0.12 -0.17 0.094 0.017 -0.31 -0.25 -0.56 1.1e+04 0.63 7.6e-06 -0.38 -
18 -1.3 -0.25 1.8 -1.9 0.63 -0.16 -0.12 -0.17 0.094 0.017 -0.31 -0.25 -0.56 1.1e+04 0.63 3.8e-06 -0.38 -
19 -1.3 -0.25 1.8 -1.9 0.63 -0.16 -0.12 -0.17 0.094 0.017 -0.31 -0.25 -0.56 1.1e+04 0.63 1.9e-06 -0.38 -
20 -1.3 -0.25 1.8 -1.9 0.63 -0.16 -0.12 -0.17 0.094 0.017 -0.31 -0.25 -0.56 1.1e+04 0.63 9.5e-07 -0.38 -
21 -1.3 -0.25 1.8 -1.9 0.63 -0.16 -0.12 -0.17 0.094 0.017 -0.31 -0.25 -0.56 1.1e+04 0.63 4.8e-07 -0.38 -
22 -1.3 -0.25 1.8 -1.9 0.63 -0.16 -0.12 -0.17 0.094 0.017 -0.31 -0.25 -0.56 1.1e+04 0.63 2.4e-07 -0.38 -
23 -1.3 -0.25 1.8 -1.9 0.63 -0.16 -0.12 -0.17 0.094 0.017 -0.31 -0.25 -0.56 1.1e+04 0.63 1.2e-07 -0.38 -
24 -1.3 -0.25 1.8 -1.9 0.63 -0.16 -0.12 -0.17 0.094 0.017 -0.31 -0.25 -0.56 1.1e+04 0.63 6e-08 -0.38 -
25 -1.3 -0.25 1.8 -1.9 0.63 -0.16 -0.12 -0.17 0.094 0.017 -0.31 -0.25 -0.56 1.1e+04 0.63 3e-08 -0.38 -
26 -1.3 -0.25 1.8 -1.9 0.63 -0.16 -0.12 -0.17 0.094 0.017 -0.31 -0.25 -0.56 1.1e+04 0.63 1.5e-08 -0.38 -
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: 27
Proportion of Hessian calculation: 2/2 = 100.0%
Optimization time: 0:00:02.908273
Calculate final gradient and BHHH
Calculate second derivatives
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.
Biogeme parameters provided by the user.
*** Initial values of the parameters are obtained from the file __b21_multiple_models_000005.iter
Parameter values restored from __b21_multiple_models_000005.iter
Starting values for the algorithm: {'asc_train_ref': -0.22042476916949647, 'asc_train_diff_male': -1.151266094199158, 'asc_train_diff_GA': 1.9592099898038795, 'b_time': -1.6961870666166756, 'lambda_time': 0.33402590778620567, 'b_cost_ref': -1.1000257376459193, 'b_cost_diff_GA': 0.9180420289202494, 'asc_car_ref': -0.42186663330205093, 'asc_car_diff_male': 0.4127085778824223, 'asc_car_diff_GA': -1.028659959596067}
Analytical Hessian method: full
As the model is not too complex, we activate the calculation of second derivatives. To change this behavior, modify the algorithm to "simple_bounds" in the TOML file.
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.74 2.9 -2.7 -0.85 -0.28 -1.1 6.6e+03 0.17 1 0.28 +
1 -0.74 2.9 -2.7 -0.85 -0.28 -1.1 6.6e+03 0.17 0.5 -0.55 -
2 -0.74 2.9 -2.7 -0.85 -0.28 -1.1 6.6e+03 0.17 0.25 -0.36 -
3 -0.74 2.9 -2.7 -0.85 -0.28 -1.1 6.6e+03 0.17 0.12 0.00036 -
4 -0.74 2.9 -2.7 -0.85 -0.28 -1.1 6.6e+03 0.17 0.062 0.078 -
5 -0.74 2.9 -2.7 -0.85 -0.28 -1.1 6.6e+03 0.17 0.031 -0.041 -
6 -0.74 2.9 -2.7 -0.85 -0.28 -1.1 6.6e+03 0.17 0.016 -0.24 -
7 -0.74 2.9 -2.7 -0.85 -0.28 -1.1 6.6e+03 0.17 0.0078 -0.26 -
8 -0.74 2.9 -2.7 -0.85 -0.28 -1.1 6.6e+03 0.17 0.0039 -0.25 -
9 -0.74 2.9 -2.7 -0.85 -0.28 -1.1 6.6e+03 0.17 0.002 -0.24 -
10 -0.74 2.9 -2.7 -0.85 -0.28 -1.1 6.6e+03 0.17 0.00098 -0.24 -
11 -0.74 2.9 -2.7 -0.85 -0.28 -1.1 6.6e+03 0.17 0.00049 -0.24 -
12 -0.74 2.9 -2.7 -0.85 -0.28 -1.1 6.6e+03 0.17 0.00024 -0.24 -
13 -0.74 2.9 -2.7 -0.85 -0.28 -1.1 6.6e+03 0.17 0.00012 -0.24 -
14 -0.74 2.9 -2.7 -0.85 -0.28 -1.1 6.6e+03 0.17 6.1e-05 -0.24 -
15 -0.74 2.9 -2.7 -0.85 -0.28 -1.1 6.6e+03 0.17 3.1e-05 -0.24 -
16 -0.74 2.9 -2.7 -0.85 -0.28 -1.1 6.6e+03 0.17 1.5e-05 -0.24 -
17 -0.74 2.9 -2.7 -0.85 -0.28 -1.1 6.6e+03 0.17 7.6e-06 -0.24 -
18 -0.74 2.9 -2.7 -0.85 -0.28 -1.1 6.6e+03 0.17 3.8e-06 -0.24 -
19 -0.74 2.9 -2.7 -0.85 -0.28 -1.1 6.6e+03 0.17 1.9e-06 -0.24 -
20 -0.74 2.9 -2.7 -0.85 -0.28 -1.1 6.6e+03 0.17 9.5e-07 -0.24 -
21 -0.74 2.9 -2.7 -0.85 -0.28 -1.1 6.6e+03 0.17 4.8e-07 -0.24 -
22 -0.74 2.9 -2.7 -0.85 -0.28 -1.1 6.6e+03 0.17 2.4e-07 -0.24 -
23 -0.74 2.9 -2.7 -0.85 -0.28 -1.1 6.6e+03 0.17 1.2e-07 -0.24 -
24 -0.74 2.9 -2.7 -0.85 -0.28 -1.1 6.6e+03 0.17 6e-08 -0.24 -
25 -0.74 2.9 -2.7 -0.85 -0.28 -1.1 6.6e+03 0.17 3e-08 -0.24 -
26 -0.74 2.9 -2.7 -0.85 -0.28 -1.1 6.6e+03 0.17 1.5e-08 -0.24 -
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: 27
Proportion of Hessian calculation: 2/2 = 100.0%
Optimization time: 0:00:02.595949
Calculate final gradient and BHHH
Calculate second derivatives
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.
Biogeme parameters provided by the user.
*** Initial values of the parameters are obtained from the file __b21_multiple_models_000006.iter
Parameter values restored from __b21_multiple_models_000006.iter
Starting values for the algorithm: {'asc_train_ref': -0.2611816966101033, 'asc_train_diff_male': -1.1195242784737038, 'asc_train_diff_GA': 1.985409833363222, 'b_time': -1.7053432288614183, 'lambda_time': 0.3292415317345787, 'b_cost_ref': -1.5754489476205231, 'b_cost_diff_inc-under50': -0.58809651569771, 'b_cost_diff_inc-50-100': 0.21526355869697572, 'b_cost_diff_inc-100+': 0.6292373530301496, 'b_cost_diff_inc-unknown': 0.817483132749231, 'asc_car_ref': -0.4530857199287251, 'asc_car_diff_male': 0.44854156261935, 'asc_car_diff_GA': -0.37092707884149506}
Analytical Hessian method: full
As the model is not too complex, we activate the calculation of second derivatives. To change this behavior, modify the algorithm to "simple_bounds" in the TOML file.
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.17 -1.2 2 -1.7 0.32 -1 1 -0.35 0.35 -1.1 4.9e+03 0.0067 1 0.84 +
1 -0.23 -1.2 2 -1.7 0.33 -1.1 2 -0.3 0.29 -1.7 4.9e+03 0.002 1 0.36 +
2 -0.23 -1.2 2 -1.7 0.33 -1.1 2 -0.3 0.29 -1.7 4.9e+03 0.002 0.5 -0.033 -
3 -0.23 -1.2 2 -1.7 0.33 -1.1 2 -0.3 0.29 -1.7 4.9e+03 0.002 0.25 -0.049 -
4 -0.23 -1.2 2 -1.7 0.33 -1.1 2 -0.3 0.29 -1.7 4.9e+03 0.002 0.12 -0.00057 -
5 -0.23 -1.2 2 -1.7 0.33 -1.1 2 -0.3 0.29 -1.7 4.9e+03 0.002 0.062 -0.05 -
6 -0.23 -1.1 1.9 -1.7 0.34 -1.1 2.1 -0.27 0.26 -1.8 4.9e+03 0.0013 0.062 0.13 +
7 -0.23 -1.1 1.9 -1.7 0.34 -1.1 2.1 -0.27 0.26 -1.8 4.9e+03 0.0013 0.031 -0.046 -
8 -0.23 -1.1 1.9 -1.7 0.34 -1.1 2.1 -0.27 0.26 -1.8 4.9e+03 0.0013 0.016 -0.12 -
9 -0.22 -1.1 2 -1.7 0.34 -1.1 2.1 -0.27 0.25 -1.8 4.9e+03 0.0015 0.016 0.2 +
10 -0.22 -1.1 2 -1.7 0.34 -1.1 2.1 -0.27 0.25 -1.8 4.9e+03 0.0015 0.0078 0.0083 -
11 -0.23 -1.1 2 -1.7 0.34 -1.1 2.1 -0.27 0.24 -1.8 4.9e+03 0.0014 0.0078 0.23 +
12 -0.23 -1.1 2 -1.7 0.34 -1.1 2.1 -0.27 0.24 -1.8 4.9e+03 0.0014 0.0039 -0.0066 -
13 -0.23 -1.1 2 -1.7 0.34 -1.1 2.1 -0.27 0.24 -1.8 4.9e+03 0.0014 0.002 0.1 -
14 -0.22 -1.1 2 -1.7 0.34 -1.1 2.1 -0.27 0.24 -1.8 4.9e+03 0.0014 0.002 0.22 +
15 -0.22 -1.1 2 -1.7 0.34 -1.1 2.1 -0.27 0.24 -1.8 4.9e+03 0.0014 0.00098 0.0087 -
16 -0.22 -1.1 2 -1.7 0.34 -1.1 2.1 -0.27 0.24 -1.8 4.9e+03 0.0014 0.00049 0.014 -
17 -0.22 -1.1 2 -1.7 0.34 -1.1 2.1 -0.27 0.24 -1.8 4.9e+03 0.0014 0.00024 0.019 -
18 -0.22 -1.1 2 -1.7 0.34 -1.1 2.1 -0.27 0.24 -1.8 4.9e+03 0.0014 0.00012 0.029 -
19 -0.22 -1.1 2 -1.7 0.34 -1.1 2.1 -0.27 0.24 -1.8 4.9e+03 0.0014 6.1e-05 0.035 -
20 -0.22 -1.1 2 -1.7 0.34 -1.1 2.1 -0.27 0.24 -1.8 4.9e+03 0.0014 3.1e-05 0.039 -
21 -0.22 -1.1 2 -1.7 0.34 -1.1 2.1 -0.27 0.24 -1.8 4.9e+03 0.0014 1.5e-05 0.042 -
22 -0.22 -1.1 2 -1.7 0.34 -1.1 2.1 -0.27 0.24 -1.8 4.9e+03 0.0014 7.6e-06 0.044 -
23 -0.22 -1.1 2 -1.7 0.34 -1.1 2.1 -0.27 0.24 -1.8 4.9e+03 0.0014 3.8e-06 0.045 -
24 -0.22 -1.1 2 -1.7 0.34 -1.1 2.1 -0.27 0.24 -1.8 4.9e+03 0.0014 1.9e-06 0.045 -
25 -0.22 -1.1 2 -1.7 0.34 -1.1 2.1 -0.27 0.24 -1.8 4.9e+03 0.0014 9.5e-07 0.046 -
26 -0.22 -1.1 2 -1.7 0.34 -1.1 2.1 -0.27 0.24 -1.8 4.9e+03 0.0014 4.8e-07 0.046 -
27 -0.22 -1.1 2 -1.7 0.34 -1.1 2.1 -0.27 0.24 -1.8 4.9e+03 0.0014 2.4e-07 0.046 -
28 -0.22 -1.1 2 -1.7 0.34 -1.1 2.1 -0.27 0.24 -1.8 4.9e+03 0.0014 1.2e-07 0.046 -
29 -0.22 -1.1 2 -1.7 0.34 -1.1 2.1 -0.27 0.24 -1.8 4.9e+03 0.0014 6e-08 0.046 -
30 -0.22 -1.1 2 -1.7 0.34 -1.1 2.1 -0.27 0.24 -1.8 4.9e+03 0.0014 3e-08 0.046 -
31 -0.22 -1.1 2 -1.7 0.34 -1.1 2.1 -0.27 0.24 -1.8 4.9e+03 0.0014 1.5e-08 0.046 -
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: 32
Proportion of Hessian calculation: 7/7 = 100.0%
Optimization time: 0:00:03.157414
Calculate final gradient and BHHH
Calculate second derivatives
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.
Biogeme parameters provided by the user.
*** Initial values of the parameters are obtained from the file __b21_multiple_models_000007.iter
Parameter values restored from __b21_multiple_models_000007.iter
Starting values for the algorithm: {'asc_train_ref': -0.21902546252532915, 'asc_train_diff_male': -1.1505866349098672, 'asc_train_diff_GA': 1.9563205717629264, 'b_time': -1.694875891360683, 'lambda_time': 0.334435139283056, 'b_cost': -1.0858025498414257, 'asc_car_ref': -0.4168292296137742, 'asc_car_diff_male': 0.41179043556673484, 'asc_car_diff_GA': -0.4472956477074032}
Analytical Hessian method: full
As the model is not too complex, we activate the calculation of second derivatives. To change this behavior, modify the algorithm to "simple_bounds" in the TOML file.
Optimization algorithm: hybrid Newton/BFGS with simple bounds [simple_bounds]
** Optimization: Newton with trust region for simple bounds
Optimization algorithm has converged.
Relative gradient: 4.813620336140356e-06
Cause of termination: Relative gradient = 4.8e-06 <= 6.1e-06
Number of function evaluations: 1
Number of gradient evaluations: 1
Number of hessian evaluations: 0
Algorithm: Newton with trust region for simple bound constraints
Number of iterations: 0
Optimization time: 0:00:00.717282
Calculate final gradient and BHHH
Calculate second derivatives
summary, description = compile_estimation_results(all_results, use_short_names=True)
print(summary)
Model_000000 ... Model_000007
Number of estimated parameters 5 ... 9
Sample size 6768 ... 6768
Final log likelihood -5292.095 ... -4881.917
Akaike Information Criterion 10594.19 ... 9781.834
Bayesian Information Criterion 10628.29 ... 9843.214
asc_train (t-test) -0.485 (-7.53) ...
b_time (t-test) -1.67 (-21.9) ... -1.69 (-21.2)
lambda_time (t-test) 0.51 (6.6) ... 0.334 (4.54)
b_cost (t-test) -1.08 (-15.9) ... -1.09 (-15)
asc_car (t-test) -0.00462 (-0.0963) ...
asc_train_ref (t-test) ... -0.219 (-2.42)
asc_train_diff_GA (t-test) ... 1.96 (21.1)
asc_car_ref (t-test) ... -0.417 (-4.23)
asc_car_diff_GA (t-test) ... -0.447 (-2.19)
asc_train_diff_male (t-test) ... -1.15 (-13.4)
asc_car_diff_male (t-test) ... 0.412 (3.95)
b_cost_ref (t-test) ...
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) ...
b_cost_diff_GA (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 b21_process_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:no_seg;b_cost:no_seg;train_tt:boxcox
Model_000001: asc:no_seg;b_cost:no_seg;train_tt:linear
Model_000002: asc:GA;b_cost:no_seg;train_tt:boxcox
Model_000003: asc:MALE-GA;b_cost:no_seg;train_tt:log
Model_000004: asc:MALE-GA;b_cost:INCOME;train_tt:boxcox
Model_000005: asc:GA;b_cost:no_seg;train_tt:log
Model_000006: asc:MALE-GA;b_cost:GA;train_tt:boxcox
Model_000007: asc:MALE-GA;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}')

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