.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/tutorials/plot_b03_importing_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_tutorials_plot_b03_importing_specification.py: Importing model specification ============================= The Python language allows to organize your model specification in different files. Michel Bierlaire, EPFL Thu May 16 13:24:56 2024 .. GENERATED FROM PYTHON SOURCE LINES 12-17 .. code-block:: Python from biogeme.biogeme import BIOGEME from biogeme.models import loglogit from biogeme.results_processing import get_pandas_estimated_parameters .. GENERATED FROM PYTHON SOURCE LINES 18-20 After having imported the necessary packages, the database and the choice variable are imported from the file `tutorial_data.py` .. GENERATED FROM PYTHON SOURCE LINES 20-22 .. code-block:: Python from tutorial_data import biogeme_database, choice .. GENERATED FROM PYTHON SOURCE LINES 23-24 Similarly, the specification of the utility functions is imported from the file `tutorial_model.py`. .. GENERATED FROM PYTHON SOURCE LINES 24-26 .. code-block:: Python from tutorial_model import utilities .. GENERATED FROM PYTHON SOURCE LINES 27-28 Once the ingredients have been imported, the rest of the script is exactly the same. .. GENERATED FROM PYTHON SOURCE LINES 28-35 .. code-block:: Python log_choice_probability = loglogit(utilities, None, choice) biogeme_object = BIOGEME(biogeme_database, log_choice_probability) biogeme_object.model_name = 'first_model' biogeme_object.calculate_null_loglikelihood(avail={0: 1, 1: 1}) results = biogeme_object.estimate() print(results.short_summary()) print(get_pandas_estimated_parameters(estimation_results=results)) .. rst-class:: sphx-glr-script-out .. code-block:: none Results for model first_model Nbr of parameters: 2 Sample size: 21 Excluded data: 0 Null log likelihood: -14.55609 Final log likelihood: -6.166042 Likelihood ratio test (null): 16.7801 Rho square (null): 0.576 Rho bar square (null): 0.439 Akaike Information Criterion: 16.33208 Bayesian Information Criterion: 18.42113 Name Value Robust std err. Robust t-stat. Robust p-value 0 asc_car -0.237573 0.805174 -0.295058 0.767950 1 b_time -0.053110 0.021672 -2.450673 0.014259 .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.744 seconds) .. _sphx_glr_download_auto_examples_tutorials_plot_b03_importing_specification.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_b03_importing_specification.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_b03_importing_specification.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_b03_importing_specification.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_