biogeme.expressions.beta_parameters module

Representation of unknown parameters

author:

Michel Bierlaire

date:

Sat Apr 20 14:54:16 2024

class biogeme.expressions.beta_parameters.Beta(name, value, lowerbound, upperbound, status)[source]

Bases: Elementary

Unknown parameters to be estimated from data.

Parameters:
  • name (str)

  • value (float)

  • lowerbound (float | None)

  • upperbound (float | None)

  • status (int)

change_init_values(betas)[source]

Modifies the initial values of the Beta parameters.

The fact that the parameters are fixed or free is irrelevant here.

Parameters:

betas (dict(string:float)) – dictionary where the keys are the names of the parameters, and the values are the new value for the parameters.

deep_flat_copy()[source]

Provides a copy of the expression. It is deep in the sense that it generates copies of the children. It is flat in the sense that any MultipleExpression is transformed into the currently selected expression. The flat part is irrelevant for this expression.

Return type:

Beta

property expression_type: TypeOfElementaryExpression

Type of elementary expression

fix_betas(beta_values, prefix=None, suffix=None)[source]

Fix all the values of the Beta parameters appearing in the dictionary

Parameters:
  • beta_values (dict(str: float)) – dictionary containing the betas to be fixed (as key) and their value.

  • prefix (str) – if not None, the parameter is renamed, with a prefix defined by this argument.

  • suffix (str) – if not None, the parameter is renamed, with a suffix defined by this argument.

get_value()[source]

Calculates the value of the expression if it is simple

Return type:

float

property is_fixed
property is_free
recursive_construct_jax_function(numerically_safe)[source]

Returns a compiled JAX-compatible function that extracts the beta value from the parameter vector using its unique index.

Return type:

Callable[[Array, Array, Array, Array], array]

Parameters:

numerically_safe (bool)

property safe_beta_id: int

Check the presence of the ID before using it