biogeme.calculator.function_call module

Module to create callable functions from Biogeme expressions.

This utility allows converting a symbolic Biogeme expression into a callable function that can be evaluated with a given parameter vector.

Michel Bierlaire Fri Mar 28 19:03:28 2025

class biogeme.calculator.function_call.CallableExpression(*args, **kwargs)[source]

Bases: Protocol

class biogeme.calculator.function_call.NamedCallableExpression(*args, **kwargs)[source]

Bases: Protocol

biogeme.calculator.function_call.function_from_compiled_formula(the_compiled_function, the_betas, named_output=False)[source]

Create a callable function from a symbolic Biogeme expression.

Parameters:
  • the_compiled_function (CompiledFormulaEvaluator) – Compiled function evaluator.

  • the_betas (dict[str, float]) – Dictionary mapping parameter names to initial values.

  • named_output (bool) – if True, the entries of the derivatives are associated with parameter names

Return type:

CallableExpression | NamedCallableExpression

Returns:

A callable that takes a NumPy array of parameter values and returns a FunctionOutput.

biogeme.calculator.function_call.function_from_expression(expression, database, numerically_safe, use_jit, the_betas, number_of_draws=None, named_output=False)[source]
Return type:

CallableExpression | NamedCallableExpression

Parameters:
  • expression (Expression)

  • database (Database)

  • numerically_safe (bool)

  • use_jit (bool)

  • the_betas (dict[str, float])

  • number_of_draws (int | None)

  • named_output (bool)