.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/assisted/plot_simple_example.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_simple_example.py: Example of a catalog ==================== Illustration of the concept of catalog. See `Bierlaire and Ortelli (2023) `_ :author: Michel Bierlaire, EPFL :date: Sun Aug 6 18:13:18 2023 .. GENERATED FROM PYTHON SOURCE LINES 13-40 .. code-block:: Python import numpy as np from biogeme import models from biogeme.expressions import Beta, Variable, Expression from biogeme.models import boxcox from biogeme.catalog import ( Catalog, generic_alt_specific_catalogs, segmentation_catalogs, ) from biogeme.nests import OneNestForNestedLogit, NestsForNestedLogit from biogeme.data.swissmetro import ( read_data, CHOICE, SM_AV, CAR_AV_SP, TRAIN_AV_SP, TRAIN_TT_SCALED, TRAIN_COST_SCALED, SM_TT_SCALED, SM_COST_SCALED, CAR_TT_SCALED, CAR_CO_SCALED, ) .. GENERATED FROM PYTHON SOURCE LINES 41-42 Function printing all configurations of an expression. .. GENERATED FROM PYTHON SOURCE LINES 42-51 .. code-block:: Python def print_all_configurations(expression: Expression) -> None: """Prints all configurations that an expression can take""" expression.set_central_controller() total = expression.central_controller.number_of_configurations() print(f'Total: {total} configurations') for config_id in expression.central_controller.all_configurations_ids: print(config_id) .. GENERATED FROM PYTHON SOURCE LINES 52-53 Parameters to be estimated. .. GENERATED FROM PYTHON SOURCE LINES 53-58 .. 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 59-60 Definition of the utility functions. .. GENERATED FROM PYTHON SOURCE LINES 60-64 .. code-block:: Python V1 = ASC_TRAIN + B_TIME * TRAIN_TT_SCALED + B_COST * TRAIN_COST_SCALED V2 = B_TIME * SM_TT_SCALED + B_COST * SM_COST_SCALED V3 = ASC_CAR + B_TIME * CAR_TT_SCALED + B_COST * CAR_CO_SCALED .. GENERATED FROM PYTHON SOURCE LINES 65-66 Associate utility functions with the numbering of alternatives. .. GENERATED FROM PYTHON SOURCE LINES 66-68 .. code-block:: Python V = {1: V1, 2: V2, 3: V3} .. GENERATED FROM PYTHON SOURCE LINES 69-70 Associate the availability conditions with the alternatives. .. GENERATED FROM PYTHON SOURCE LINES 70-72 .. code-block:: Python av = {1: TRAIN_AV_SP, 2: SM_AV, 3: CAR_AV_SP} .. GENERATED FROM PYTHON SOURCE LINES 73-75 Definition of the model. This is the contribution of each observation to the log likelihood function. .. GENERATED FROM PYTHON SOURCE LINES 75-77 .. code-block:: Python logprob_logit = models.loglogit(V, av, CHOICE) .. GENERATED FROM PYTHON SOURCE LINES 78-79 Nest definition. .. GENERATED FROM PYTHON SOURCE LINES 79-84 .. code-block:: Python mu_existing = Beta('mu_existing', 1, 1, 10, 0) existing = OneNestForNestedLogit(nest_param=mu_existing, list_of_alternatives=[1, 3]) nests = NestsForNestedLogit(choice_set=list(V), tuple_of_nests=(existing,)) .. GENERATED FROM PYTHON SOURCE LINES 85-86 Contribution to the log-likelihood. .. GENERATED FROM PYTHON SOURCE LINES 86-88 .. code-block:: Python logprob_nested = models.lognested(V, av, nests, CHOICE) .. GENERATED FROM PYTHON SOURCE LINES 89-91 Definition of the catalog containing two models specifications: logit and nested logit. .. GENERATED FROM PYTHON SOURCE LINES 91-99 .. code-block:: Python model_catalog = Catalog.from_dict( catalog_name='model_catalog', dict_of_expressions={ 'logit': logprob_logit, 'nested': logprob_nested, }, ) .. GENERATED FROM PYTHON SOURCE LINES 100-101 Current status of the catalog. .. GENERATED FROM PYTHON SOURCE LINES 101-103 .. code-block:: Python print(model_catalog) .. rst-class:: sphx-glr-script-out .. code-block:: none [model_catalog: logit]_bioLogLogit[choice=CHOICE]U=(1:((Beta('ASC_TRAIN', 0, None, None, 0) + (Beta('B_TIME', 0, None, None, 0) * TRAIN_TT_SCALED)) + (Beta('B_COST', 0, None, None, 0) * TRAIN_COST_SCALED)), 2:((Beta('B_TIME', 0, None, None, 0) * SM_TT_SCALED) + (Beta('B_COST', 0, None, None, 0) * SM_COST_SCALED)), 3:((Beta('ASC_CAR', 0, None, None, 0) + (Beta('B_TIME', 0, None, None, 0) * CAR_TT_SCALED)) + (Beta('B_COST', 0, None, None, 0) * CAR_CO_SCALED)))av=(1:TRAIN_AV_SP, 2:SM_AV, 3:CAR_AV_SP) .. GENERATED FROM PYTHON SOURCE LINES 104-105 Use the controller to select a different configuration. .. GENERATED FROM PYTHON SOURCE LINES 105-108 .. code-block:: Python model_catalog.controlled_by.set_name('nested') print(model_catalog) .. rst-class:: sphx-glr-script-out .. code-block:: none [model_catalog: nested]_bioLogLogit[choice=CHOICE]U=(1:(((Beta('ASC_TRAIN', 0, None, None, 0) + (Beta('B_TIME', 0, None, None, 0) * TRAIN_TT_SCALED)) + (Beta('B_COST', 0, None, None, 0) * TRAIN_COST_SCALED)) + (((Beta('mu_existing', 1, 1, 10, 0) - `1.0`) * ((Beta('ASC_TRAIN', 0, None, None, 0) + (Beta('B_TIME', 0, None, None, 0) * TRAIN_TT_SCALED)) + (Beta('B_COST', 0, None, None, 0) * TRAIN_COST_SCALED))) + (((`1.0` / Beta('mu_existing', 1, 1, 10, 0)) - `1.0`) * log(ConditionalSum((TRAIN_AV_SP != `0.0`): exp((Beta('mu_existing', 1, 1, 10, 0) * ((Beta('ASC_TRAIN', 0, None, None, 0) + (Beta('B_TIME', 0, None, None, 0) * TRAIN_TT_SCALED)) + (Beta('B_COST', 0, None, None, 0) * TRAIN_COST_SCALED)))), (CAR_AV_SP != `0.0`): exp((Beta('mu_existing', 1, 1, 10, 0) * ((Beta('ASC_CAR', 0, None, None, 0) + (Beta('B_TIME', 0, None, None, 0) * CAR_TT_SCALED)) + (Beta('B_COST', 0, None, None, 0) * CAR_CO_SCALED))))))))), 2:(((Beta('B_TIME', 0, None, None, 0) * SM_TT_SCALED) + (Beta('B_COST', 0, None, None, 0) * SM_COST_SCALED)) + `0.0`), 3:(((Beta('ASC_CAR', 0, None, None, 0) + (Beta('B_TIME', 0, None, None, 0) * CAR_TT_SCALED)) + (Beta('B_COST', 0, None, None, 0) * CAR_CO_SCALED)) + (((Beta('mu_existing', 1, 1, 10, 0) - `1.0`) * ((Beta('ASC_CAR', 0, None, None, 0) + (Beta('B_TIME', 0, None, None, 0) * CAR_TT_SCALED)) + (Beta('B_COST', 0, None, None, 0) * CAR_CO_SCALED))) + (((`1.0` / Beta('mu_existing', 1, 1, 10, 0)) - `1.0`) * log(ConditionalSum((TRAIN_AV_SP != `0.0`): exp((Beta('mu_existing', 1, 1, 10, 0) * ((Beta('ASC_TRAIN', 0, None, None, 0) + (Beta('B_TIME', 0, None, None, 0) * TRAIN_TT_SCALED)) + (Beta('B_COST', 0, None, None, 0) * TRAIN_COST_SCALED)))), (CAR_AV_SP != `0.0`): exp((Beta('mu_existing', 1, 1, 10, 0) * ((Beta('ASC_CAR', 0, None, None, 0) + (Beta('B_TIME', 0, None, None, 0) * CAR_TT_SCALED)) + (Beta('B_COST', 0, None, None, 0) * CAR_CO_SCALED))))))))))av=(1:TRAIN_AV_SP, 2:SM_AV, 3:CAR_AV_SP) .. GENERATED FROM PYTHON SOURCE LINES 109-110 Iterator. .. GENERATED FROM PYTHON SOURCE LINES 110-113 .. code-block:: Python for specification in model_catalog: print(specification) .. rst-class:: sphx-glr-script-out .. code-block:: none [model_catalog: logit]_bioLogLogit[choice=CHOICE]U=(1:((Beta('ASC_TRAIN', 0, None, None, 0) + (Beta('B_TIME', 0, None, None, 0) * TRAIN_TT_SCALED)) + (Beta('B_COST', 0, None, None, 0) * TRAIN_COST_SCALED)), 2:((Beta('B_TIME', 0, None, None, 0) * SM_TT_SCALED) + (Beta('B_COST', 0, None, None, 0) * SM_COST_SCALED)), 3:((Beta('ASC_CAR', 0, None, None, 0) + (Beta('B_TIME', 0, None, None, 0) * CAR_TT_SCALED)) + (Beta('B_COST', 0, None, None, 0) * CAR_CO_SCALED)))av=(1:TRAIN_AV_SP, 2:SM_AV, 3:CAR_AV_SP) [model_catalog: nested]_bioLogLogit[choice=CHOICE]U=(1:(((Beta('ASC_TRAIN', 0, None, None, 0) + (Beta('B_TIME', 0, None, None, 0) * TRAIN_TT_SCALED)) + (Beta('B_COST', 0, None, None, 0) * TRAIN_COST_SCALED)) + (((Beta('mu_existing', 1, 1, 10, 0) - `1.0`) * ((Beta('ASC_TRAIN', 0, None, None, 0) + (Beta('B_TIME', 0, None, None, 0) * TRAIN_TT_SCALED)) + (Beta('B_COST', 0, None, None, 0) * TRAIN_COST_SCALED))) + (((`1.0` / Beta('mu_existing', 1, 1, 10, 0)) - `1.0`) * log(ConditionalSum((TRAIN_AV_SP != `0.0`): exp((Beta('mu_existing', 1, 1, 10, 0) * ((Beta('ASC_TRAIN', 0, None, None, 0) + (Beta('B_TIME', 0, None, None, 0) * TRAIN_TT_SCALED)) + (Beta('B_COST', 0, None, None, 0) * TRAIN_COST_SCALED)))), (CAR_AV_SP != `0.0`): exp((Beta('mu_existing', 1, 1, 10, 0) * ((Beta('ASC_CAR', 0, None, None, 0) + (Beta('B_TIME', 0, None, None, 0) * CAR_TT_SCALED)) + (Beta('B_COST', 0, None, None, 0) * CAR_CO_SCALED))))))))), 2:(((Beta('B_TIME', 0, None, None, 0) * SM_TT_SCALED) + (Beta('B_COST', 0, None, None, 0) * SM_COST_SCALED)) + `0.0`), 3:(((Beta('ASC_CAR', 0, None, None, 0) + (Beta('B_TIME', 0, None, None, 0) * CAR_TT_SCALED)) + (Beta('B_COST', 0, None, None, 0) * CAR_CO_SCALED)) + (((Beta('mu_existing', 1, 1, 10, 0) - `1.0`) * ((Beta('ASC_CAR', 0, None, None, 0) + (Beta('B_TIME', 0, None, None, 0) * CAR_TT_SCALED)) + (Beta('B_COST', 0, None, None, 0) * CAR_CO_SCALED))) + (((`1.0` / Beta('mu_existing', 1, 1, 10, 0)) - `1.0`) * log(ConditionalSum((TRAIN_AV_SP != `0.0`): exp((Beta('mu_existing', 1, 1, 10, 0) * ((Beta('ASC_TRAIN', 0, None, None, 0) + (Beta('B_TIME', 0, None, None, 0) * TRAIN_TT_SCALED)) + (Beta('B_COST', 0, None, None, 0) * TRAIN_COST_SCALED)))), (CAR_AV_SP != `0.0`): exp((Beta('mu_existing', 1, 1, 10, 0) * ((Beta('ASC_CAR', 0, None, None, 0) + (Beta('B_TIME', 0, None, None, 0) * CAR_TT_SCALED)) + (Beta('B_COST', 0, None, None, 0) * CAR_CO_SCALED))))))))))av=(1:TRAIN_AV_SP, 2:SM_AV, 3:CAR_AV_SP) .. GENERATED FROM PYTHON SOURCE LINES 114-115 All configurations. .. GENERATED FROM PYTHON SOURCE LINES 115-117 .. code-block:: Python print_all_configurations(model_catalog) .. rst-class:: sphx-glr-script-out .. code-block:: none Total: 2 configurations model_catalog:logit model_catalog:nested .. GENERATED FROM PYTHON SOURCE LINES 118-133 .. code-block:: Python TRAIN_TT = Variable('TRAIN_TT') TRAIN_COST = Variable('TRAIN_COST') ell_travel_time = Beta('lambda_travel_time', 1, -10, 10, 0) linear_train_tt = TRAIN_TT boxcox_train_tt = boxcox(TRAIN_TT, ell_travel_time) squared_train_tt = TRAIN_TT * TRAIN_TT train_tt_catalog = Catalog.from_dict( catalog_name='train_tt_catalog', dict_of_expressions={ 'linear': linear_train_tt, 'boxcox': boxcox_train_tt, 'squared': squared_train_tt, }, ) .. GENERATED FROM PYTHON SOURCE LINES 134-135 Define a utility function involving the catalog. .. GENERATED FROM PYTHON SOURCE LINES 135-139 .. code-block:: Python ASC_TRAIN = Beta('ASC_TRAIN', 0, None, None, 0) B_TIME = Beta('B_TIME', 0, None, 0, 0) V_TRAIN = ASC_TRAIN + B_TIME * train_tt_catalog .. GENERATED FROM PYTHON SOURCE LINES 140-142 .. code-block:: Python print_all_configurations(V_TRAIN) .. rst-class:: sphx-glr-script-out .. code-block:: none Total: 3 configurations train_tt_catalog:squared train_tt_catalog:linear train_tt_catalog:boxcox .. GENERATED FROM PYTHON SOURCE LINES 143-144 Unsynchronized catalogs .. GENERATED FROM PYTHON SOURCE LINES 144-158 .. code-block:: Python CAR_TT = Variable('CAR_TT') CAR_COST = Variable('CAR_COST') linear_car_tt = CAR_TT boxcox_car_tt = boxcox(CAR_TT, ell_travel_time) squared_car_tt = CAR_TT * CAR_TT car_tt_catalog = Catalog.from_dict( catalog_name='car_tt_catalog', dict_of_expressions={ 'linear': linear_car_tt, 'boxcox': boxcox_car_tt, 'squared': squared_car_tt, }, ) .. GENERATED FROM PYTHON SOURCE LINES 159-160 Create a dummy expression with the two catalogs. .. GENERATED FROM PYTHON SOURCE LINES 160-162 .. code-block:: Python dummy_expression = train_tt_catalog + car_tt_catalog .. GENERATED FROM PYTHON SOURCE LINES 163-165 .. code-block:: Python print_all_configurations(dummy_expression) .. rst-class:: sphx-glr-script-out .. code-block:: none Total: 9 configurations car_tt_catalog:linear;train_tt_catalog:linear car_tt_catalog:squared;train_tt_catalog:linear car_tt_catalog:linear;train_tt_catalog:squared car_tt_catalog:linear;train_tt_catalog:boxcox car_tt_catalog:boxcox;train_tt_catalog:boxcox car_tt_catalog:boxcox;train_tt_catalog:linear car_tt_catalog:boxcox;train_tt_catalog:squared car_tt_catalog:squared;train_tt_catalog:boxcox car_tt_catalog:squared;train_tt_catalog:squared .. GENERATED FROM PYTHON SOURCE LINES 166-167 Synchronized catalogs. .. GENERATED FROM PYTHON SOURCE LINES 167-182 .. code-block:: Python CAR_TT = Variable('CAR_TT') CAR_COST = Variable('CAR_COST') linear_car_tt = CAR_TT boxcox_car_tt = boxcox(CAR_TT, ell_travel_time) squared_car_tt = CAR_TT * CAR_TT car_tt_catalog = Catalog.from_dict( catalog_name='car_tt_catalog', dict_of_expressions={ 'linear': linear_car_tt, 'boxcox': boxcox_car_tt, 'squared': squared_car_tt, }, controlled_by=train_tt_catalog.controlled_by, ) .. GENERATED FROM PYTHON SOURCE LINES 183-184 Create a dummy expression with the two catalogs. .. GENERATED FROM PYTHON SOURCE LINES 184-186 .. code-block:: Python dummy_expression = train_tt_catalog + car_tt_catalog .. GENERATED FROM PYTHON SOURCE LINES 187-189 .. code-block:: Python print_all_configurations(dummy_expression) .. rst-class:: sphx-glr-script-out .. code-block:: none Total: 3 configurations train_tt_catalog:squared train_tt_catalog:linear train_tt_catalog:boxcox .. GENERATED FROM PYTHON SOURCE LINES 190-191 Alternative specific specification. .. GENERATED FROM PYTHON SOURCE LINES 191-198 .. code-block:: Python (B_TIME_catalog_dict, B_COST_catalog_dict) = generic_alt_specific_catalogs( generic_name='coefficients', beta_parameters=[B_TIME, B_COST], alternatives=('TRAIN', 'CAR'), ) .. GENERATED FROM PYTHON SOURCE LINES 199-200 Create utility functions involving those catalogs. .. GENERATED FROM PYTHON SOURCE LINES 200-205 .. code-block:: Python V_TRAIN = ( B_TIME_catalog_dict['TRAIN'] * TRAIN_TT + B_COST_catalog_dict['TRAIN'] * TRAIN_COST ) V_CAR = B_TIME_catalog_dict['CAR'] * CAR_TT + B_COST_catalog_dict['CAR'] * CAR_COST .. GENERATED FROM PYTHON SOURCE LINES 206-207 Create a dummy expression involving the utility functions. .. GENERATED FROM PYTHON SOURCE LINES 207-209 .. code-block:: Python dummy_expression = V_TRAIN + V_CAR .. GENERATED FROM PYTHON SOURCE LINES 210-212 .. code-block:: Python print_all_configurations(dummy_expression) .. rst-class:: sphx-glr-script-out .. code-block:: none Total: 2 configurations coefficients_gen_altspec:generic coefficients_gen_altspec:altspec .. GENERATED FROM PYTHON SOURCE LINES 213-214 Alternative specific - not synchronized. .. GENERATED FROM PYTHON SOURCE LINES 214-227 .. code-block:: Python (B_TIME_catalog_dict,) = generic_alt_specific_catalogs( generic_name='time_coefficient', beta_parameters=[B_TIME], alternatives=('TRAIN', 'CAR'), ) (B_COST_catalog_dict,) = generic_alt_specific_catalogs( generic_name='cost_coefficient', beta_parameters=[B_COST], alternatives=('TRAIN', 'CAR'), ) .. GENERATED FROM PYTHON SOURCE LINES 228-229 Create utility functions involving those catalogs. .. GENERATED FROM PYTHON SOURCE LINES 229-234 .. code-block:: Python V_TRAIN = ( B_TIME_catalog_dict['TRAIN'] * TRAIN_TT + B_COST_catalog_dict['TRAIN'] * TRAIN_COST ) V_CAR = B_TIME_catalog_dict['CAR'] * CAR_TT + B_COST_catalog_dict['CAR'] * CAR_COST .. GENERATED FROM PYTHON SOURCE LINES 235-236 Create a dummy expression involving the utility functions. .. GENERATED FROM PYTHON SOURCE LINES 236-238 .. code-block:: Python dummy_expression = V_TRAIN + V_CAR .. GENERATED FROM PYTHON SOURCE LINES 239-241 .. code-block:: Python print_all_configurations(dummy_expression) .. rst-class:: sphx-glr-script-out .. code-block:: none Total: 4 configurations cost_coefficient_gen_altspec:altspec;time_coefficient_gen_altspec:generic cost_coefficient_gen_altspec:generic;time_coefficient_gen_altspec:altspec cost_coefficient_gen_altspec:altspec;time_coefficient_gen_altspec:altspec cost_coefficient_gen_altspec:generic;time_coefficient_gen_altspec:generic .. GENERATED FROM PYTHON SOURCE LINES 242-243 Read the data .. GENERATED FROM PYTHON SOURCE LINES 243-245 .. code-block:: Python database = read_data() .. GENERATED FROM PYTHON SOURCE LINES 246-247 Segmentation .. GENERATED FROM PYTHON SOURCE LINES 249-251 We consider two trip purposes: `commuters` and anything else. We need to define a binary variable first. .. GENERATED FROM PYTHON SOURCE LINES 251-253 .. code-block:: Python database.data['COMMUTERS'] = np.where(database.data['PURPOSE'] == 1, 1, 0) .. GENERATED FROM PYTHON SOURCE LINES 254-255 Segmentation on trip purpose. .. GENERATED FROM PYTHON SOURCE LINES 255-261 .. code-block:: Python segmentation_purpose = database.generate_segmentation( variable='COMMUTERS', mapping={0: 'non_commuters', 1: 'commuters'}, reference='non_commuters', ) .. GENERATED FROM PYTHON SOURCE LINES 262-263 Segmentation on luggage. .. GENERATED FROM PYTHON SOURCE LINES 263-269 .. code-block:: Python segmentation_luggage = database.generate_segmentation( variable='LUGGAGE', mapping={0: 'no_lugg', 1: 'one_lugg', 3: 'several_lugg'}, reference='no_lugg', ) .. GENERATED FROM PYTHON SOURCE LINES 270-272 Catalog of segmented alternative specific constants, allows a maximum of two segmentations. .. GENERATED FROM PYTHON SOURCE LINES 272-282 .. code-block:: Python ASC_TRAIN_catalog, ASC_CAR_catalog = segmentation_catalogs( generic_name='ASC', beta_parameters=[ASC_TRAIN, ASC_CAR], potential_segmentations=( segmentation_purpose, segmentation_luggage, ), maximum_number=2, ) .. GENERATED FROM PYTHON SOURCE LINES 283-284 Create a dummy expression. .. GENERATED FROM PYTHON SOURCE LINES 284-286 .. code-block:: Python dummy_expression = ASC_TRAIN_catalog + ASC_CAR_catalog .. GENERATED FROM PYTHON SOURCE LINES 287-289 .. code-block:: Python print_all_configurations(dummy_expression) .. rst-class:: sphx-glr-script-out .. code-block:: none Total: 4 configurations ASC:no_seg ASC:COMMUTERS-LUGGAGE ASC:COMMUTERS ASC:LUGGAGE .. GENERATED FROM PYTHON SOURCE LINES 290-292 Catalog of segmented alternative specific constants, allows a maximum of one segmentation. .. GENERATED FROM PYTHON SOURCE LINES 292-302 .. code-block:: Python ASC_TRAIN_catalog, ASC_CAR_catalog = segmentation_catalogs( generic_name='ASC', beta_parameters=[ASC_TRAIN, ASC_CAR], potential_segmentations=( segmentation_purpose, segmentation_luggage, ), maximum_number=1, ) .. GENERATED FROM PYTHON SOURCE LINES 303-304 Create a dummy expression. .. GENERATED FROM PYTHON SOURCE LINES 304-306 .. code-block:: Python dummy_expression = ASC_TRAIN_catalog + ASC_CAR_catalog .. GENERATED FROM PYTHON SOURCE LINES 307-309 .. code-block:: Python print_all_configurations(dummy_expression) .. rst-class:: sphx-glr-script-out .. code-block:: none Total: 3 configurations ASC:no_seg ASC:COMMUTERS ASC:LUGGAGE .. GENERATED FROM PYTHON SOURCE LINES 310-312 Segmentation and alternative specific Maximum one segmentation. .. GENERATED FROM PYTHON SOURCE LINES 312-323 .. code-block:: Python (B_TIME_catalog_dict,) = generic_alt_specific_catalogs( generic_name='B_TIME', beta_parameters=[B_TIME], alternatives=['TRAIN', 'CAR'], potential_segmentations=( segmentation_purpose, segmentation_luggage, ), maximum_number=1, ) .. GENERATED FROM PYTHON SOURCE LINES 324-326 .. code-block:: Python print_all_configurations(B_TIME_catalog_dict['TRAIN']) .. rst-class:: sphx-glr-script-out .. code-block:: none Total: 6 configurations B_TIME:COMMUTERS;B_TIME_gen_altspec:altspec B_TIME:COMMUTERS;B_TIME_gen_altspec:generic B_TIME:LUGGAGE;B_TIME_gen_altspec:altspec B_TIME:no_seg;B_TIME_gen_altspec:generic B_TIME:no_seg;B_TIME_gen_altspec:altspec B_TIME:LUGGAGE;B_TIME_gen_altspec:generic .. GENERATED FROM PYTHON SOURCE LINES 327-328 Maximum two segmentations. .. GENERATED FROM PYTHON SOURCE LINES 328-339 .. code-block:: Python (B_TIME_catalog_dict,) = generic_alt_specific_catalogs( generic_name='B_TIME', beta_parameters=[B_TIME], alternatives=['TRAIN', 'CAR'], potential_segmentations=( segmentation_purpose, segmentation_luggage, ), maximum_number=2, ) .. GENERATED FROM PYTHON SOURCE LINES 340-341 .. code-block:: Python print_all_configurations(B_TIME_catalog_dict['TRAIN']) .. rst-class:: sphx-glr-script-out .. code-block:: none Total: 8 configurations B_TIME:COMMUTERS;B_TIME_gen_altspec:altspec B_TIME:COMMUTERS;B_TIME_gen_altspec:generic B_TIME:COMMUTERS-LUGGAGE;B_TIME_gen_altspec:altspec B_TIME:LUGGAGE;B_TIME_gen_altspec:altspec B_TIME:no_seg;B_TIME_gen_altspec:generic B_TIME:COMMUTERS-LUGGAGE;B_TIME_gen_altspec:generic B_TIME:no_seg;B_TIME_gen_altspec:altspec B_TIME:LUGGAGE;B_TIME_gen_altspec:generic .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.383 seconds) .. _sphx_glr_download_auto_examples_assisted_plot_simple_example.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_simple_example.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_simple_example.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_simple_example.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_