biogeme.models.mev module
Implements the Multivariate Extreme Value models.
- author:
Michel Bierlaire
- date:
Wed Oct 25 11:35:34 2023
- biogeme.models.mev.logmev(util, log_gi, av, choice)[source]
Log of the choice probability for a MEV model.
- Parameters:
util (
dict
[int
,Expression
|float
|int
|bool
]) – dict of objects representing the utility functions of each alternative, indexed by numerical ids.log_gi (
dict
[int
,Expression
|float
|int
|bool
]) –a dictionary mapping each alternative id with the function
\[\ln \frac{\partial G}{\partial y_i} (e^{V_1},\ldots,e^{V_J})\]where \(G\) is the MEV generating function. If an alternative \(i\) is not available, then \(G_i = 0\).
av (
dict
[int
,Expression
|float
|int
|bool
]) – 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.choice (
Expression
|float
|int
|bool
) – id of the alternative for which the probability must be calculated.
- Return type:
- Returns:
log of the choice probability of the MEV model, given by
\[V_i + \ln G_i(e^{V_1},\ldots,e^{V_J}) - \ln\left(\sum_j e^{V_j + \ln G_j(e^{V_1}, \ldots,e^{V_J})}\right)\]
- biogeme.models.mev.logmev_endogenousSampling(util, log_gi, av, correction, choice)[source]
Warning
This function is deprecated. Use
logmev_endogenous_sampling()
instead.- Parameters:
util (dict[int, Expression | float | int | bool])
log_gi (dict[int, Expression])
av (dict[int, Expression | float | int | bool] | None)
correction (dict[int, Expression | float | int | bool])
choice (Expression | float | int | bool)
- biogeme.models.mev.logmev_endogenous_sampling(util, log_gi, av, correction, choice)[source]
Log of choice probability for a MEV model, including the correction for endogenous sampling as proposed by Bierlaire, Bolduc and McFadden (2008).
- Parameters:
util (dict(int:biogeme.expressions.expr.Expression)) – dict of objects representing the utility functions of each alternative, indexed by numerical ids.
log_gi (dict(int:biogeme.expressions.expr.Expression)) –
a dictionary mapping each alternative id with the function
\[\ln \frac{\partial G}{\partial y_i} (e^{V_1}, \ldots, e^{V_J})\]where \(G\) is the MEV generating function. If an alternative \(i\) is not available, then \(G_i = 0\).
av (dict(int:biogeme.expressions.expr.Expression)) – 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.
correction (dict(int:biogeme.expressions.expr.Expression)) – a dict of expressions for the correstion terms of each alternative.
choice (biogeme.expressions.expr.Expression) – id of the alternative for which the probability must be calculated.
- Returns:
log of the choice probability of the MEV model, given by
\[V_i + \ln G_i(e^{V_1}, \ldots,e^{V_J}) + \omega_i - \ln\left(\sum_j e^{V_j + \ln G_j(e^{V_1}, \ldots, e^{V_J})+ \omega_j}\right)\]where \(\omega_i\) is the correction term for alternative \(i\).
- Return type:
biogeme.expressions.expr.Expression
- Parameters:
util (dict[int, Expression | float | int | bool])
log_gi (dict[int, Expression])
av (dict[int, Expression | float | int | bool] | None)
correction (dict[int, Expression | float | int | bool])
choice (Expression | float | int | bool)
- biogeme.models.mev.mev(util, log_gi, av, choice)[source]
Choice probability for a MEV model.
- Parameters:
util (dict(int:biogeme.expressions.expr.Expression)) – dict of objects representing the utility functions of each alternative, indexed by numerical ids.
log_gi (dict(int:biogeme.expressions.expr.Expression)) –
a dictionary mapping each alternative id with the function
\[\ln \frac{\partial G}{\partial y_i} (e^{V_1}, \ldots, e^{V_J})\]where \(G\) is the MEV generating function. If an alternative \(i\) is not available, then \(G_i = 0\).
av (dict(int:biogeme.expressions.expr.Expression)) – 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.
choice (biogeme.expressions.expr.Expression) – id of the alternative for which the probability must be calculated.
- Returns:
Choice probability of the MEV model, given by
\[\frac{e^{V_i + \ln G_i(e^{V_1}, \ldots,e^{V_J})}}{\sum_j e^{V_j + \ln G_j(e^{V_1},\ldots,e^{V_J})}}\]- Return type:
biogeme.expressions.expr.Expression
- Parameters:
util (dict[int, Expression | float | int | bool])
log_gi (dict[int, Expression])
av (dict[int, Expression | float | int | bool] | None)
choice (Expression | float | int | bool)
- biogeme.models.mev.mev_endogenousSampling(util, log_gi, av, correction, choice)[source]
Warning
This function is deprecated. Use
mev_endogenous_sampling()
instead.- Parameters:
util (dict[int, Expression | float | int | bool])
log_gi (dict[int, Expression])
av (dict[int, Expression | float | int | bool] | None)
correction (dict[int, Expression | float | int | bool])
choice (Expression | float | int | bool)
- biogeme.models.mev.mev_endogenous_sampling(util, log_gi, av, correction, choice)[source]
Choice probability for a MEV model, including the correction for endogenous sampling as proposed by Bierlaire, Bolduc and McFadden (2008).
- Parameters:
util (dict(int:biogeme.expressions.expr.Expression)) – dict of objects representing the utility functions of each alternative, indexed by numerical ids.
log_gi (dict(int:biogeme.expressions.expr.Expression)) –
a dictionary mapping each alternative id with the function
\[\ln \frac{\partial G}{\partial y_i} (e^{V_1}, \ldots, e^{V_J})\]where \(G\) is the MEV generating function. If an alternative \(i\) is not available, then \(G_i = 0\).
av (dict(int:biogeme.expressions.expr.Expression)) – 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.
correction (dict(int:biogeme.expressions.expr.Expression)) – a dict of expressions for the correstion terms of each alternative.
choice (biogeme.expressions.expr.Expression) – id of the alternative for which the probability must be calculated.
- Returns:
log of the choice probability of the MEV model, given by
\[V_i + \ln G_i(e^{V_1}, \ldots, e^{V_J}) + \omega_i - \ln\left(\sum_j e^{V_j + \ln G_j(e^{V_1},\ldots,e^{V_J})+ \omega_j}\right)\]where \(\omega_i\) is the correction term for alternative \(i\).
- Return type:
biogeme.expressions.expr.Expression
- Parameters:
util (dict[int, Expression | float | int | bool])
log_gi (dict[int, Expression])
av (dict[int, Expression | float | int | bool] | None)
correction (dict[int, Expression | float | int | bool])
choice (Expression | float | int | bool)