.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/sampling/specification.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_sampling_specification.py: Model specification =================== Script containing the model specification. :author: Michel Bierlaire :date: Wed Nov 1 17:37:33 2023 .. GENERATED FROM PYTHON SOURCE LINES 11-14 .. code-block:: default from biogeme.expressions import Beta, Variable, log from biogeme.sampling_of_alternatives import CrossVariableTuple .. GENERATED FROM PYTHON SOURCE LINES 15-17 Variable combining attributes of the alternatives and characteristics of the decision-maker .. GENERATED FROM PYTHON SOURCE LINES 17-30 .. code-block:: default combined_variables = [ CrossVariableTuple( 'log_dist', log( ( (Variable('user_lat') - Variable('rest_lat')) ** 2 + (Variable('user_lon') - Variable('rest_lon')) ** 2 ) ** 0.5 ), ) ] .. GENERATED FROM PYTHON SOURCE LINES 31-32 Parameters to estimate. .. GENERATED FROM PYTHON SOURCE LINES 32-44 .. code-block:: default beta_rating = Beta('beta_rating', 0, None, None, 0) beta_price = Beta('beta_price', 0, None, None, 0) beta_chinese = Beta('beta_chinese', 0, None, None, 0) beta_japanese = Beta('beta_japanese', 0, None, None, 0) beta_korean = Beta('beta_korean', 0, None, None, 0) beta_indian = Beta('beta_indian', 0, None, None, 0) beta_french = Beta('beta_french', 0, None, None, 0) beta_mexican = Beta('beta_mexican', 0, None, None, 0) beta_lebanese = Beta('beta_lebanese', 0, None, None, 0) beta_ethiopian = Beta('beta_ethiopian', 0, None, None, 0) beta_log_dist = Beta('beta_log_dist', 0, None, None, 0) .. GENERATED FROM PYTHON SOURCE LINES 45-46 Utility function. .. GENERATED FROM PYTHON SOURCE LINES 46-59 .. code-block:: default V = ( beta_rating * Variable('rating') + beta_price * Variable('price') + beta_chinese * Variable('category_Chinese') + beta_japanese * Variable('category_Japanese') + beta_korean * Variable('category_Korean') + beta_indian * Variable('category_Indian') + beta_french * Variable('category_French') + beta_mexican * Variable('category_Mexican') + beta_lebanese * Variable('category_Lebanese') + beta_ethiopian * Variable('category_Ethiopian') + beta_log_dist * Variable('log_dist') ) .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.000 seconds) .. _sphx_glr_download_auto_examples_sampling_specification.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: specification.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: specification.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_