biogeme.expressions.calculator module

Interface with the C++ implementation

author:

Michel Bierlaire

date:

Sat Sep 9 15:25:07 2023

biogeme.expressions.calculator.calculate_function_and_derivatives(the_expression, database, calculate_gradient, calculate_hessian, calculate_bhhh, aggregation)[source]

Interface with the C++ implementation calculating the expression

Parameters:
  • the_expression (Expression) – expression to calculate for each entry in the database.

  • database (Database) – database. If no database is provided, the expression must not contain any variable.

  • calculate_gradient (bool) – If True, the gradient is calculated.

  • calculate_hessian (bool) – if True, the hessian is calculated.

  • calculate_bhhh (bool) – if True, the BHHH matrix is calculated.

  • aggregation (bool) – if a database is provided, and this parameter is True, the expression is applied on each entry of the database, and all values are aggregated, so that the sum is returned. If False, the list of all values is returned.

Raises:

BiogemeError – if a database is needed and not available.

Return type:

BiogemeFunctionOutputSmartOutputProxy | BiogemeDisaggregateFunctionOutputSmartOutputProxy