biogeme.expressions.convert module

Convert expressions to float and vice versa

Michel Bierlaire Thu Apr 11 15:31:15 2024

biogeme.expressions.convert.expression_to_value(expression, betas=None)[source]

Convert to float, if possible :type expression: Expression | float | int | bool :param expression: expression to be converted :rtype: float :return: numerical value

Parameters:
  • expression (Expression | float | int | bool)

  • betas (dict[str, float] | None)

Return type:

float

biogeme.expressions.convert.get_dict_expressions(the_dict)[source]

If the dictionary contains float, they are transformed into a numerical expression.

Return type:

dict[int, Expression]

Parameters:

the_dict (dict[int, Expression | float | int | bool])

biogeme.expressions.convert.get_dict_values(the_dict, betas=None)[source]

If the dictionary contains Expressions, they are transformed into a numerical expression.

Return type:

dict[int, float]

Parameters:
  • the_dict (dict[int, Expression | float | int | bool])

  • betas (dict[str, float] | None)

biogeme.expressions.convert.validate_and_convert(expression)[source]

Validates the expression and returns the converted expression if necessary.

Return type:

Expression

Parameters:

expression (Expression | float | int | bool)