.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/assisted/plot_b03alt_spec.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_assisted_plot_b03alt_spec.py: Catalog for alternative specific coefficients ============================================= Investigate alternative specific parameters: - two specifications for the travel time coefficient: generic, and alternative specific, - two specifications for the travel cost coefficient: generic, and alternative specific, for a total of 4 specifications. See `Bierlaire and Ortelli (2023) `_. Michel Bierlaire, EPFL Sun Apr 27 2025, 15:49:05 .. GENERATED FROM PYTHON SOURCE LINES 21-46 .. code-block:: Python from IPython.core.display_functions import display import biogeme.biogeme_logging as blog from biogeme.biogeme import BIOGEME from biogeme.catalog import generic_alt_specific_catalogs from biogeme.data.swissmetro import ( CAR_AV_SP, CAR_CO_SCALED, CAR_TT_SCALED, CHOICE, SM_AV, SM_COST_SCALED, SM_TT_SCALED, TRAIN_AV_SP, TRAIN_COST_SCALED, TRAIN_TT_SCALED, read_data, ) from biogeme.expressions import Beta from biogeme.models import loglogit from biogeme.results_processing import compile_estimation_results, pareto_optimal logger = blog.get_screen_logger(level=blog.INFO) .. GENERATED FROM PYTHON SOURCE LINES 47-48 Parameters to be estimated. .. GENERATED FROM PYTHON SOURCE LINES 48-53 .. code-block:: Python asc_car = Beta('asc_car', 0, None, None, 0) asc_train = Beta('asc_train', 0, None, None, 0) b_time = Beta('b_time', 0, None, None, 0) b_cost = Beta('b_cost', 0, None, None, 0) .. GENERATED FROM PYTHON SOURCE LINES 54-55 Catalog for travel time coefficient. .. GENERATED FROM PYTHON SOURCE LINES 55-61 .. code-block:: Python (b_time_catalog_dict,) = generic_alt_specific_catalogs( generic_name='b_time', beta_parameters=[b_time], alternatives=('train', 'swissmetro', 'car'), ) .. GENERATED FROM PYTHON SOURCE LINES 62-63 Catalog for travel cost coefficient. .. GENERATED FROM PYTHON SOURCE LINES 63-69 .. code-block:: Python (b_cost_catalog_dict,) = generic_alt_specific_catalogs( generic_name='b_cost', beta_parameters=[b_cost], alternatives=('train', 'swissmetro', 'car'), ) .. GENERATED FROM PYTHON SOURCE LINES 70-71 Definition of the utility functions. .. GENERATED FROM PYTHON SOURCE LINES 71-86 .. code-block:: Python v_train = ( asc_train + b_time_catalog_dict['train'] * TRAIN_TT_SCALED + b_cost_catalog_dict['train'] * TRAIN_COST_SCALED ) v_swissmetro = ( b_time_catalog_dict['swissmetro'] * SM_TT_SCALED + b_cost_catalog_dict['swissmetro'] * SM_COST_SCALED ) v_car = ( asc_car + b_time_catalog_dict['car'] * CAR_TT_SCALED + b_cost_catalog_dict['car'] * CAR_CO_SCALED ) .. GENERATED FROM PYTHON SOURCE LINES 87-88 Associate utility functions with the numbering of alternatives. .. GENERATED FROM PYTHON SOURCE LINES 88-90 .. code-block:: Python v = {1: v_train, 2: v_swissmetro, 3: v_car} .. GENERATED FROM PYTHON SOURCE LINES 91-92 Associate the availability conditions with the alternatives. .. GENERATED FROM PYTHON SOURCE LINES 92-94 .. code-block:: Python av = {1: TRAIN_AV_SP, 2: SM_AV, 3: CAR_AV_SP} .. GENERATED FROM PYTHON SOURCE LINES 95-97 Definition of the model. This is the contribution of each observation to the log likelihood function. .. GENERATED FROM PYTHON SOURCE LINES 97-99 .. code-block:: Python log_probability = loglogit(v, av, CHOICE) .. GENERATED FROM PYTHON SOURCE LINES 100-101 Read the data .. GENERATED FROM PYTHON SOURCE LINES 101-103 .. code-block:: Python database = read_data() .. GENERATED FROM PYTHON SOURCE LINES 104-105 Create the Biogeme object. .. GENERATED FROM PYTHON SOURCE LINES 105-110 .. code-block:: Python the_biogeme = BIOGEME( database, log_probability, generate_html=False, generate_yaml=False ) the_biogeme.model_name = 'b01alt_spec' .. rst-class:: sphx-glr-script-out .. code-block:: none Biogeme parameters read from biogeme.toml. .. GENERATED FROM PYTHON SOURCE LINES 111-112 Estimate the parameters. .. GENERATED FROM PYTHON SOURCE LINES 112-114 .. code-block:: Python dict_of_results = the_biogeme.estimate_catalog() .. rst-class:: sphx-glr-script-out .. code-block:: none Estimating 4 models. Biogeme parameters provided by the user. *** Initial values of the parameters are obtained from the file __b01alt_spec_000000.iter Parameter values restored from __b01alt_spec_000000.iter Starting values for the algorithm: {'asc_train': -0.019677954254812977, 'b_time_train': -1.4035204568960171, 'b_cost_train': -1.8538931895561404, 'b_time_swissmetro': -1.4600247945313696, 'b_cost_swissmetro': -0.7866329830682577, 'asc_car': -0.5950658046556297, 'b_time_car': -1.0574354441678266, 'b_cost_car': -0.6588841886011664} 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 b_time_train b_cost b_time_swissmet asc_car b_time_car Function Relgrad Radius Rho 0 -0.22 -1.6 -1 -1.5 -0.23 -0.73 9e+03 0.11 1 0.5 + 1 -0.22 -1.6 -1 -1.5 -0.23 -0.73 9e+03 0.11 0.43 0.086 - 2 -0.26 -1.7 -1.4 -1.5 -0.08 -0.55 8.9e+03 0.12 0.43 0.32 + 3 -0.24 -1.7 -1.9 -1.6 -0.012 -0.45 8.9e+03 0.15 0.43 0.11 + 4 -0.24 -1.7 -1.9 -1.6 -0.012 -0.45 8.9e+03 0.15 0.21 -0.041 - 5 -0.24 -1.7 -1.9 -1.6 -0.012 -0.45 8.9e+03 0.15 0.11 -0.066 - 6 -0.24 -1.7 -1.9 -1.6 -0.012 -0.45 8.9e+03 0.15 0.054 0.019 - 7 -0.24 -1.7 -1.9 -1.6 -0.012 -0.45 8.9e+03 0.15 0.027 0.069 - 8 -0.24 -1.7 -1.9 -1.6 0.0039 -0.42 8.9e+03 0.15 0.027 0.1 + 9 -0.24 -1.7 -1.9 -1.6 0.0039 -0.42 8.9e+03 0.15 0.013 0.059 - 10 -0.24 -1.7 -1.9 -1.6 0.0039 -0.42 8.9e+03 0.15 0.0067 0.052 - 11 -0.24 -1.7 -1.9 -1.6 0.0039 -0.42 8.9e+03 0.15 0.0034 0.068 - 12 -0.24 -1.7 -1.9 -1.6 0.0039 -0.42 8.9e+03 0.15 0.0017 0.075 - 13 -0.24 -1.7 -1.9 -1.6 0.0039 -0.42 8.9e+03 0.15 0.00084 0.076 - 14 -0.24 -1.7 -1.9 -1.6 0.0039 -0.42 8.9e+03 0.15 0.00042 0.077 - 15 -0.24 -1.7 -1.9 -1.6 0.0039 -0.42 8.9e+03 0.15 0.00021 0.077 - 16 -0.24 -1.7 -1.9 -1.6 0.0039 -0.42 8.9e+03 0.15 0.0001 0.077 - 17 -0.24 -1.7 -1.9 -1.6 0.0039 -0.42 8.9e+03 0.15 5.2e-05 0.077 - 18 -0.24 -1.7 -1.9 -1.6 0.0039 -0.42 8.9e+03 0.15 2.6e-05 0.078 - 19 -0.24 -1.7 -1.9 -1.6 0.0039 -0.42 8.9e+03 0.15 1.3e-05 0.078 - 20 -0.24 -1.7 -1.9 -1.6 0.0039 -0.42 8.9e+03 0.15 6.5e-06 0.078 - 21 -0.24 -1.7 -1.9 -1.6 0.0039 -0.42 8.9e+03 0.15 3.3e-06 0.078 - 22 -0.24 -1.7 -1.9 -1.6 0.0039 -0.42 8.9e+03 0.15 1.6e-06 0.078 - 23 -0.24 -1.7 -1.9 -1.6 0.0039 -0.42 8.9e+03 0.15 8.2e-07 0.078 - 24 -0.24 -1.7 -1.9 -1.6 0.0039 -0.42 8.9e+03 0.15 4.1e-07 0.078 - 25 -0.24 -1.7 -1.9 -1.6 0.0039 -0.42 8.9e+03 0.15 2e-07 0.078 - 26 -0.24 -1.7 -1.9 -1.6 0.0039 -0.42 8.9e+03 0.15 1e-07 0.078 - 27 -0.24 -1.7 -1.9 -1.6 0.0039 -0.42 8.9e+03 0.15 5.1e-08 0.078 - 28 -0.24 -1.7 -1.9 -1.6 0.0039 -0.42 8.9e+03 0.15 2.6e-08 0.078 - 29 -0.24 -1.7 -1.9 -1.6 0.0039 -0.42 8.9e+03 0.15 1.3e-08 0.078 - Optimization algorithm has *not* converged. Algorithm: Newton with trust region for simple bound constraints Cause of termination: Trust region is too small: 1.278217874817229e-08 Number of iterations: 30 Proportion of Hessian calculation: 5/5 = 100.0% Optimization time: 0:00:00.383772 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. Biogeme parameters provided by the user. *** Initial values of the parameters are obtained from the file __b01alt_spec_000001.iter Parameter values restored from __b01alt_spec_000001.iter Starting values for the algorithm: {'asc_train': -0.652238664271019, 'b_time': -1.2789413398819158, 'b_cost': -0.7897904566401142, 'asc_car': 0.01622793815045202} 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_train b_cost_swissmet asc_car b_cost_car Function Relgrad Radius Rho 0 -0.65 -1.3 0 0 0.016 0 9e+03 0.086 0.5 -0.58 - 1 -0.65 -1.3 0 0 0.016 0 9e+03 0.086 0.25 -0.61 - 2 -0.65 -1.3 0 0 0.016 0 9e+03 0.086 0.12 -0.86 - 3 -0.65 -1.3 0 0 0.016 0 9e+03 0.086 0.062 -1.8 - 4 -0.65 -1.3 0 0 0.016 0 9e+03 0.086 0.031 -1.1 - 5 -0.65 -1.3 0 0 0.016 0 9e+03 0.086 0.016 -0.78 - 6 -0.65 -1.3 0 0 0.016 0 9e+03 0.086 0.0078 -0.66 - 7 -0.65 -1.3 0 0 0.016 0 9e+03 0.086 0.0039 -0.61 - 8 -0.65 -1.3 0 0 0.016 0 9e+03 0.086 0.002 -0.59 - 9 -0.65 -1.3 0 0 0.016 0 9e+03 0.086 0.00098 -0.58 - 10 -0.65 -1.3 0 0 0.016 0 9e+03 0.086 0.00049 -0.57 - 11 -0.65 -1.3 0 0 0.016 0 9e+03 0.086 0.00024 -0.57 - 12 -0.65 -1.3 0 0 0.016 0 9e+03 0.086 0.00012 -0.57 - 13 -0.65 -1.3 0 0 0.016 0 9e+03 0.086 6.1e-05 -0.56 - 14 -0.65 -1.3 0 0 0.016 0 9e+03 0.086 3.1e-05 -0.56 - 15 -0.65 -1.3 0 0 0.016 0 9e+03 0.086 1.5e-05 -0.56 - 16 -0.65 -1.3 0 0 0.016 0 9e+03 0.086 7.6e-06 -0.56 - 17 -0.65 -1.3 0 0 0.016 0 9e+03 0.086 3.8e-06 -0.56 - 18 -0.65 -1.3 0 0 0.016 0 9e+03 0.086 1.9e-06 -0.56 - 19 -0.65 -1.3 0 0 0.016 0 9e+03 0.086 9.5e-07 -0.56 - 20 -0.65 -1.3 0 0 0.016 0 9e+03 0.086 4.8e-07 -0.56 - 21 -0.65 -1.3 0 0 0.016 0 9e+03 0.086 2.4e-07 -0.56 - 22 -0.65 -1.3 0 0 0.016 0 9e+03 0.086 1.2e-07 -0.56 - 23 -0.65 -1.3 0 0 0.016 0 9e+03 0.086 6e-08 -0.56 - 24 -0.65 -1.3 0 0 0.016 0 9e+03 0.086 3e-08 -0.56 - 25 -0.65 -1.3 0 0 0.016 0 9e+03 0.086 1.5e-08 -0.56 - 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.316094 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. Biogeme parameters provided by the user. *** Initial values of the parameters are obtained from the file __b01alt_spec_000002.iter Parameter values restored from __b01alt_spec_000002.iter Starting values for the algorithm: {'asc_train': -0.04600967948106339, 'b_time': -1.2700621694169116, 'b_cost_train': -1.919425253291788, 'b_cost_swissmetro': -0.8231956949362126, 'asc_car': -0.41549753284358953, 'b_cost_car': -0.38347919498386734} Optimization algorithm: hybrid Newton/BFGS with simple bounds [simple_bounds] ** Optimization: Newton with trust region for simple bounds Iter. asc_train b_time_train b_cost_train b_time_swissmet b_cost_swissmet asc_car b_time_car b_cost_car Function Relgrad Radius Rho 0 -0.33 -0.84 -1.9 -0.69 -1.6 -0.13 -0.65 -0.82 9.1e+03 0.19 1 0.47 + 1 -0.33 -0.84 -1.9 -0.69 -1.6 -0.13 -0.65 -0.82 9.1e+03 0.19 0.46 -9.8 - 2 -0.33 -0.84 -1.9 -0.69 -1.6 -0.13 -0.65 -0.82 9.1e+03 0.19 0.23 -2.7 - 3 -0.33 -0.84 -1.9 -0.69 -1.6 -0.13 -0.65 -0.82 9.1e+03 0.19 0.11 -0.7 - 4 -0.33 -0.84 -1.9 -0.69 -1.6 -0.13 -0.65 -0.82 9.1e+03 0.19 0.057 0.027 - 5 -0.39 -0.9 -1.9 -0.63 -1.5 -0.18 -0.7 -0.88 9e+03 0.19 0.057 0.23 + 6 -0.33 -0.95 -1.9 -0.58 -1.4 -0.24 -0.76 -0.93 9e+03 0.19 0.057 0.19 + 7 -0.28 -1 -1.8 -0.52 -1.4 -0.3 -0.82 -0.99 8.9e+03 0.18 0.057 0.17 + 8 -0.29 -1.1 -1.8 -0.46 -1.3 -0.35 -0.87 -1 8.9e+03 0.18 0.057 0.14 + 9 -0.26 -1 -1.7 -0.4 -1.3 -0.41 -0.93 -1.1 8.9e+03 0.17 0.057 0.11 + 10 -0.26 -1 -1.7 -0.4 -1.3 -0.41 -0.93 -1.1 8.9e+03 0.17 0.028 0.027 - 11 -0.26 -1 -1.7 -0.4 -1.3 -0.41 -0.93 -1.1 8.9e+03 0.17 0.014 0.073 - 12 -0.26 -1 -1.7 -0.4 -1.3 -0.41 -0.93 -1.1 8.9e+03 0.17 0.0071 0.068 - 13 -0.26 -1 -1.7 -0.4 -1.3 -0.41 -0.93 -1.1 8.9e+03 0.17 0.0036 0.066 - 14 -0.26 -1 -1.7 -0.4 -1.3 -0.41 -0.93 -1.1 8.9e+03 0.17 0.0018 0.064 - 15 -0.26 -1 -1.7 -0.4 -1.3 -0.41 -0.93 -1.1 8.9e+03 0.17 0.00089 0.064 - 16 -0.26 -1 -1.7 -0.4 -1.3 -0.41 -0.93 -1.1 8.9e+03 0.17 0.00044 0.064 - 17 -0.26 -1 -1.7 -0.4 -1.3 -0.41 -0.93 -1.1 8.9e+03 0.17 0.00022 0.064 - 18 -0.26 -1 -1.7 -0.4 -1.3 -0.41 -0.93 -1.1 8.9e+03 0.17 0.00011 0.064 - 19 -0.26 -1 -1.7 -0.4 -1.3 -0.41 -0.93 -1.1 8.9e+03 0.17 5.6e-05 0.064 - 20 -0.26 -1 -1.7 -0.4 -1.3 -0.41 -0.93 -1.1 8.9e+03 0.17 2.8e-05 0.064 - 21 -0.26 -1 -1.7 -0.4 -1.3 -0.41 -0.93 -1.1 8.9e+03 0.17 1.4e-05 0.064 - 22 -0.26 -1 -1.7 -0.4 -1.3 -0.41 -0.93 -1.1 8.9e+03 0.17 7e-06 0.064 - 23 -0.26 -1 -1.7 -0.4 -1.3 -0.41 -0.93 -1.1 8.9e+03 0.17 3.5e-06 0.064 - 24 -0.26 -1 -1.7 -0.4 -1.3 -0.41 -0.93 -1.1 8.9e+03 0.17 1.7e-06 0.064 - 25 -0.26 -1 -1.7 -0.4 -1.3 -0.41 -0.93 -1.1 8.9e+03 0.17 8.7e-07 0.064 - 26 -0.26 -1 -1.7 -0.4 -1.3 -0.41 -0.93 -1.1 8.9e+03 0.17 4.3e-07 0.064 - 27 -0.26 -1 -1.7 -0.4 -1.3 -0.41 -0.93 -1.1 8.9e+03 0.17 2.2e-07 0.064 - 28 -0.26 -1 -1.7 -0.4 -1.3 -0.41 -0.93 -1.1 8.9e+03 0.17 1.1e-07 0.064 - 29 -0.26 -1 -1.7 -0.4 -1.3 -0.41 -0.93 -1.1 8.9e+03 0.17 5.4e-08 0.064 - 30 -0.26 -1 -1.7 -0.4 -1.3 -0.41 -0.93 -1.1 8.9e+03 0.17 2.7e-08 0.064 - 31 -0.26 -1 -1.7 -0.4 -1.3 -0.41 -0.93 -1.1 8.9e+03 0.17 1.4e-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.3577787116831426e-08 Number of iterations: 32 Proportion of Hessian calculation: 7/7 = 100.0% Optimization time: 0:00:00.441780 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. Biogeme parameters provided by the user. *** Initial values of the parameters are obtained from the file __b01alt_spec_000003.iter Parameter values restored from __b01alt_spec_000003.iter Starting values for the algorithm: {'asc_train': -0.14412205501933395, 'b_time_train': -1.758918388044104, 'b_cost': -0.7893801438971159, 'b_time_swissmetro': -1.4667704942116189, 'asc_car': -0.5438801230042781, 'b_time_car': -0.9979945188921027} 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.59 -0.85 -0.67 -0.18 1e+04 0.19 1 0.52 + 1 -0.74 -1.7 -0.7 0.19 9.7e+03 0.28 1 0.21 + 2 -0.74 -1.7 -0.7 0.19 9.7e+03 0.28 0.4 0.075 - 3 -1.1 -2.1 -0.66 0.29 9.3e+03 0.26 0.4 0.53 + 4 -1.5 -2.5 -0.69 0.24 9.2e+03 0.24 0.4 0.38 + 5 -1.5 -2.5 -0.69 0.24 9.2e+03 0.24 0.2 0.0035 - 6 -1.5 -2.5 -0.69 0.24 9.2e+03 0.24 0.1 0.005 - 7 -1.5 -2.5 -0.69 0.24 9.2e+03 0.24 0.051 0.0085 - 8 -1.5 -2.5 -0.69 0.24 9.2e+03 0.24 0.025 0.018 - 9 -1.5 -2.5 -0.69 0.24 9.2e+03 0.24 0.013 0.036 - 10 -1.5 -2.5 -0.69 0.24 9.2e+03 0.24 0.0063 0.047 - 11 -1.5 -2.5 -0.69 0.24 9.2e+03 0.24 0.0032 0.052 - 12 -1.5 -2.5 -0.69 0.24 9.2e+03 0.24 0.0016 0.055 - 13 -1.5 -2.5 -0.69 0.24 9.2e+03 0.24 0.00079 0.056 - 14 -1.5 -2.5 -0.69 0.24 9.2e+03 0.24 0.00039 0.057 - 15 -1.5 -2.5 -0.69 0.24 9.2e+03 0.24 0.0002 0.057 - 16 -1.5 -2.5 -0.69 0.24 9.2e+03 0.24 9.9e-05 0.057 - 17 -1.5 -2.5 -0.69 0.24 9.2e+03 0.24 4.9e-05 0.057 - 18 -1.5 -2.5 -0.69 0.24 9.2e+03 0.24 2.5e-05 0.057 - 19 -1.5 -2.5 -0.69 0.24 9.2e+03 0.24 1.2e-05 0.057 - 20 -1.5 -2.5 -0.69 0.24 9.2e+03 0.24 6.2e-06 0.057 - 21 -1.5 -2.5 -0.69 0.24 9.2e+03 0.24 3.1e-06 0.057 - 22 -1.5 -2.5 -0.69 0.24 9.2e+03 0.24 1.5e-06 0.057 - 23 -1.5 -2.5 -0.69 0.24 9.2e+03 0.24 7.7e-07 0.057 - 24 -1.5 -2.5 -0.69 0.24 9.2e+03 0.24 3.9e-07 0.057 - 25 -1.5 -2.5 -0.69 0.24 9.2e+03 0.24 1.9e-07 0.057 - 26 -1.5 -2.5 -0.69 0.24 9.2e+03 0.24 9.6e-08 0.057 - 27 -1.5 -2.5 -0.69 0.24 9.2e+03 0.24 4.8e-08 0.057 - 28 -1.5 -2.5 -0.69 0.24 9.2e+03 0.24 2.4e-08 0.057 - 29 -1.5 -2.5 -0.69 0.24 9.2e+03 0.24 1.2e-08 0.057 - Optimization algorithm has *not* converged. Algorithm: Newton with trust region for simple bound constraints Cause of termination: Trust region is too small: 1.2043595453523925e-08 Number of iterations: 30 Proportion of Hessian calculation: 5/5 = 100.0% Optimization time: 0:00:00.426791 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. .. GENERATED FROM PYTHON SOURCE LINES 115-116 Number of estimated models. .. GENERATED FROM PYTHON SOURCE LINES 116-118 .. code-block:: Python print(f'A total of {len(dict_of_results)} models have been estimated') .. rst-class:: sphx-glr-script-out .. code-block:: none A total of 4 models have been estimated .. GENERATED FROM PYTHON SOURCE LINES 119-120 All estimation results .. GENERATED FROM PYTHON SOURCE LINES 120-124 .. code-block:: Python compiled_results, specs = compile_estimation_results( dict_of_results, use_short_names=True ) .. GENERATED FROM PYTHON SOURCE LINES 125-128 .. code-block:: Python display('All estimated models') display(compiled_results) .. rst-class:: sphx-glr-script-out .. code-block:: none All estimated models Model_000000 ... Model_000003 Number of estimated parameters 6 ... 4 Sample size 10719 ... 10719 Final log likelihood -11373.86 ... -10108.68 Akaike Information Criterion 22759.72 ... 20225.36 Bayesian Information Criterion 22803.4 ... 20254.48 asc_train (t-test) -0.24 (-2.1) ... -1.53 (-11.8) b_time_train (t-test) -1.68 (-16.4) ... b_cost (t-test) -1.88 (-13.2) ... -0.688 (-12) b_time_swissmetro (t-test) -1.57 (-9.39) ... asc_car (t-test) 0.00392 (0.0362) ... 0.237 (4.44) b_time_car (t-test) -0.425 (-6.05) ... b_time (t-test) ... -2.47 (-16.6) b_cost_train (t-test) ... b_cost_swissmetro (t-test) ... b_cost_car (t-test) ... [15 rows x 4 columns] .. GENERATED FROM PYTHON SOURCE LINES 129-130 Glossary .. GENERATED FROM PYTHON SOURCE LINES 130-133 .. code-block:: Python for short_name, spec in specs.items(): print(f'{short_name}\t{spec}') .. rst-class:: sphx-glr-script-out .. code-block:: none Model_000000 b_cost_gen_altspec:generic;b_time_gen_altspec:altspec Model_000001 b_cost_gen_altspec:altspec;b_time_gen_altspec:generic Model_000002 b_cost_gen_altspec:altspec;b_time_gen_altspec:altspec Model_000003 b_cost_gen_altspec:generic;b_time_gen_altspec:generic .. GENERATED FROM PYTHON SOURCE LINES 134-135 Estimation results of the Pareto optimal models. .. GENERATED FROM PYTHON SOURCE LINES 135-140 .. code-block:: Python pareto_results = pareto_optimal(dict_of_results) compiled_pareto_results, pareto_specs = compile_estimation_results( pareto_results, use_short_names=True ) .. rst-class:: sphx-glr-script-out .. code-block:: none No Pareto file has been provided .. GENERATED FROM PYTHON SOURCE LINES 141-144 .. code-block:: Python display('Non dominated models') display(compiled_pareto_results) .. rst-class:: sphx-glr-script-out .. code-block:: none Non dominated models Model_000000 ... Model_000002 Number of estimated parameters 8 ... 6 Sample size 10719 ... 10719 Final log likelihood -8936.217 ... -8976.551 Akaike Information Criterion 17888.43 ... 17965.1 Bayesian Information Criterion 17946.67 ... 18008.78 asc_train (t-test) -0.264 (-3.26) ... -0.652 (-9.77) b_time_train (t-test) -1.05 (-14.2) ... b_cost_train (t-test) -1.7 (-14) ... 0 (0) b_time_swissmetro (t-test) -0.404 (-6.14) ... b_cost_swissmetro (t-test) -1.27 (-16.3) ... 0 (0) asc_car (t-test) -0.412 (-5.09) ... 0.0162 (0.293) b_time_car (t-test) -0.931 (-7.8) ... b_cost_car (t-test) -1.1 (-7.8) ... 0 (0) b_time (t-test) ... -1.28 (-17.4) b_cost (t-test) ... [15 rows x 3 columns] .. GENERATED FROM PYTHON SOURCE LINES 145-146 Glossary. .. GENERATED FROM PYTHON SOURCE LINES 146-148 .. code-block:: Python for short_name, spec in pareto_specs.items(): print(f'{short_name}\t{spec}') .. rst-class:: sphx-glr-script-out .. code-block:: none Model_000000 b_cost_gen_altspec:altspec;b_time_gen_altspec:altspec Model_000001 b_cost_gen_altspec:generic;b_time_gen_altspec:generic Model_000002 b_cost_gen_altspec:altspec;b_time_gen_altspec:generic .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 4.156 seconds) .. _sphx_glr_download_auto_examples_assisted_plot_b03alt_spec.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_b03alt_spec.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_b03alt_spec.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_b03alt_spec.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_