biogeme.mdcev.translated module
Implementation of the “translated” MDCEV model. See the technical report.
Michel Bierlaire Tue Apr 9 09:12:55 2024
- class biogeme.mdcev.translated.Translated(model_name, baseline_utilities, gamma_parameters, alpha_parameters=None, scale_parameter=None, weights=None)[source]
Bases:
Mdcev
Implementation of the “translated” MDCEV model
- Parameters:
model_name (str)
baseline_utilities (dict[int, Expression])
gamma_parameters (dict[int, Expression | None])
alpha_parameters (dict[int, Expression] | None)
scale_parameter (Expression | None)
weights (Expression | None)
- calculate_inverse_of_determinant_one_alternative(the_id, consumption)[source]
- Calculate the inverse of the entries for the determinant. For
the outside good, gamma is equal to 0.
- Parameters:
the_id (
int
) – identifier of the good.consumption (
Expression
) – expression for the consumption.
- Return type:
- calculate_log_determinant_one_alternative(the_id, consumption)[source]
- Calculate the log of the entries for the determinant. For
the outside good, gamma is equal to 0.
- Parameters:
the_id (
int
) – identifier of the good.consumption (
Expression
) – expression for the consumption.
- Return type:
- derivative_utility_one_alternative(the_id, the_consumption, epsilon, one_observation)[source]
Used in the optimization problem solved for forecasting tp calculate the dual variable.
- Return type:
float
- Parameters:
the_id (int)
the_consumption (float)
epsilon (float)
one_observation (Database)
- lower_bound_dual_variable(chosen_alternatives, one_observation, epsilon)[source]
Method providing model specific bounds on the dual variable. It not overloaded, default values are used.
- Parameters:
chosen_alternatives (
set
[int
]) – list of alternatives that are chosen at the optimal solutionone_observation (
Database
) – data for one observation.epsilon (
ndarray
) – draws from the error term.
- Return type:
float
- Returns:
a lower bound on the dual variable, such that the expenditure calculated for any larger value is
well-defined and non negative.
- optimal_consumption_one_alternative(the_id, dual_variable, epsilon, one_observation)[source]
Analytical calculation of the optimal consumption if the dual variable is known.
- Return type:
float
- Parameters:
the_id (int)
dual_variable (float)
epsilon (float)
one_observation (Database)
- transformed_utility(the_id, the_consumption)[source]
Calculates the utility for one alternative.
- Return type:
- Parameters:
the_id (int)
the_consumption (Expression)
- utility_expression_one_alternative(the_id, the_consumption, unscaled_epsilon)[source]
Utility expression. Used only for code validation.
- Return type:
- Parameters:
the_id (int)
the_consumption (Expression)
unscaled_epsilon (Expression)