biogeme.models.logit module

Implements the logit model.

author:

Michel Bierlaire

date:

Wed Oct 25 08:43:26 2023

biogeme.models.logit.logit(util, av, i)[source]

The logit model

The model is defined as

\[\frac{a_i e^{V_i}}{\sum_{i=1}^J a_j e^{V_j}}\]
Parameters:
  • util (dict[int, Expression | float | int | bool]) – dict of objects representing the utility functions of each alternative, indexed by numerical ids.

  • av (dict[int, Expression | float | int | bool] | None) – dict of objects representing the availability of each alternative (\(a_i\) in the above formula), indexed by numerical ids. Must be consistent with util, or None. In this case, all alternatives are supposed to be always available.

  • i (Expression | float | int | bool) – id of the alternative for which the probability must be calculated.

Return type:

Expression

Returns:

choice probability of alternative number i.

biogeme.models.logit.loglogit(util, av, i)[source]

The logarithm of the logit model

The model is defined as

\[\frac{a_i e^{V_i}}{\sum_{i=1}^J a_j e^{V_j}}\]
Parameters:
  • util (dict[int, Expression | float | int | bool]) – dict of objects representing the utility functions of each alternative, indexed by numerical ids.

  • av (dict[int, Expression | float | int | bool] | None) – dict of objects representing the availability of each alternative (\(a_i\) in the above formula), indexed by numerical ids. Must be consistent with util, or None. In this case, all alternatives are supposed to be always available.

  • i (Expression | float | int | bool) – id of the alternative for which the probability must be calculated.

Return type:

Expression

Returns:

choice probability of alternative number i.