biogeme.results_processing.html_output module

Generates an HTML output

Michel Bierlaire Wed Oct 2 16:10:54 2024

biogeme.results_processing.html_output.format_real_number(value)[source]

Format a real number to be included in the HTML table

Return type:

str

Parameters:

value (float)

biogeme.results_processing.html_output.generate_html_file(estimation_results, filename, overwrite=False, variance_covariance_type=None, group_of_parameters=None)[source]

Generate an HTML file with the estimation results

Parameters:
  • estimation_results (EstimationResults) – estimation results

  • filename (str) – name of the file

  • overwrite – if True and the file exists, it is overwritten

  • variance_covariance_type (EstimateVarianceCovariance | None) – select which type of variance-covariance matrix is used to generate the statistics. If None, the bootstrap one is used if available. If not available, the robust one.

  • group_of_parameters (dict[str, list[str]] | None) – dictionary mapping section names to lists of parameter names. If None, all estimated parameters are reported in one table. If provided, one table is generated for each group, and another table is generated for parameters that do not appear in any group.

Return type:

None

biogeme.results_processing.html_output.get_html_condition_number(estimation_results)[source]

Report the smallest and largest eigenvalues, and the condition number.

Parameters:

estimation_results (EstimationResults) – estimation results

Return type:

str

Returns:

HTML code

biogeme.results_processing.html_output.get_html_correlation_results(estimation_results, variance_covariance_type=None, involved_parameters=None)[source]

Get the correlation results in an HTML format

Parameters:
  • estimation_results (EstimationResults) – estimation results.

  • variance_covariance_type (EstimateVarianceCovariance | None) – type of variance-covariance estimate to be used.

  • involved_parameters (dict[str, str] | None) – a dict that identifies the parameters to involve, as assign them with a name for the reporting.

Return type:

str

Returns:

HTML code

biogeme.results_processing.html_output.get_html_estimated_parameters(estimation_results, group_of_parameters=None, renaming_parameters=None, sort_by_name=False, variance_covariance_type=None)[source]

Get the estimated parameters coded in HTML.

The function returns one HTML table for each group of parameters. If no group is provided, a single table containing all estimated parameters is returned. If groups are provided, one table is generated for each group, and an additional table is generated for the parameters that do not belong to any group. A parameter may appear in several groups.

Parameters:
  • estimation_results (EstimationResults) – estimation results.

  • group_of_parameters (dict[str, list[str]]) – dictionary mapping the name of each group to the corresponding list of parameters. If None, all parameters are reported in a single table.

  • renaming_parameters (dict[str, str] | None) – a dict that suggests new names for some or all parameters.

  • sort_by_name (bool) – if True, parameters are sorted alphabetically by name.

  • variance_covariance_type (EstimateVarianceCovariance | None) – type of variance-covariance estimate to be used.

Return type:

dict[str, str]

Returns:

dictionary mapping each group name to the corresponding HTML code. The key is an empty string when no grouping is requested.

Prepare the footer for the HTML file, containing comments and the version of Biogeme.

Return type:

str

biogeme.results_processing.html_output.get_html_general_statistics(estimation_results)[source]

Get the general statistics coded in HTML

Return type:

str

Returns:

HTML code

Parameters:

estimation_results (EstimationResults)

biogeme.results_processing.html_output.get_html_header(estimation_results)[source]

Prepare the header for the HTML file, containing comments and the version of Biogeme.

Return type:

str

Returns:

string containing the header.

Parameters:

estimation_results (EstimationResults)

biogeme.results_processing.html_output.get_html_one_pair_of_parameters(estimation_results, first_parameter_index, second_parameter_index, variance_covariance_type, first_parameter_name=None, second_parameter_name=None)[source]

Generate one row of the HTML table of the correlation data for estimated parameters.

Parameters:
  • estimation_results (EstimationResults) – estimation results.

  • first_parameter_index (int) – index of the first parameter

  • second_parameter_index (int) – index of the second parameter

  • variance_covariance_type (EstimateVarianceCovariance) – type of variance-covariance estimate to be used.

  • first_parameter_name – name of the parameter to report. If None, taken from estimation results.

  • second_parameter_name – name of the parameter to report. If None, taken from estimation results.

Return type:

str

Returns:

one row of the table

biogeme.results_processing.html_output.get_html_one_parameter(estimation_results, parameter_index, variance_covariance_type, parameter_number=None, parameter_name=None)[source]

Generate the HTML code for one row of the table of the estimated parameters.

Parameters:
  • estimation_results (EstimationResults) – estimation results.

  • parameter_index (int) – index of the parameter

  • variance_covariance_type (EstimateVarianceCovariance) – type of variance-covariance estimate to be used.

  • parameter_number – number of the parameter to report. If None, it is the index.

  • parameter_name – name of the parameter to report. If None, taken from estimation results.

Returns:

HTML code for the row

biogeme.results_processing.html_output.get_html_preamble(estimation_results, file_name)[source]

Generates the first part of the HTML, with the preamble information.

Parameters:
  • estimation_results (EstimationResults) – estimation results

  • file_name (str) – name of the HTML file (used only for reporting)

Return type:

str

Returns:

HTML code