biogeme.expressions.log_sampled_cross_nested module¶
Arithmetic expressions accepted by Biogeme: sampled cross-nested logit.
- class biogeme.expressions.log_sampled_cross_nested.LogSampleCrossNested(utilities, log_probabilities, alphas, mev_utilities, mev_weights, mev_alphas, nests, choice=0)[source]¶
Bases:
ExpressionLog probability for a sampled cross-nested logit model.
This expression is designed for the sampling-of-alternatives framework.
It represents the same expression currently generated by
GenerateModel.get_cross_nested_logit:\[\log P(0 \mid S) = K_0 - \log \sum_{i \in S} \exp(K_i),\]where
\[K_i = V_i - \omega_i + \log G_i,\]and
\[G_i = \sum_m \alpha_{im}^{\mu_m} \exp((\mu_m - 1) V_i) B_m^{1/\mu_m - 1},\]with
\[B_m = \sum_{j \in S^{MEV}} w_j \alpha_{jm}^{\mu_m} \exp(\mu_m V_j).\]The expression avoids constructing a large tree of
ConditionalSum,ConditionalTermTuple,exp,logzero, andloglogitexpressions.- Parameters:
utilities (dict[int, ExpressionOrNumeric])
log_probabilities (dict[int, ExpressionOrNumeric])
alphas (dict[str, dict[int, ExpressionOrNumeric]])
mev_utilities (dict[int, ExpressionOrNumeric])
mev_weights (dict[int, ExpressionOrNumeric])
mev_alphas (dict[str, dict[int, ExpressionOrNumeric]])
nests (NestsForCrossNestedLogit | OldNestsForCrossNestedLogit)
choice (ExpressionOrNumeric)
- get_value()[source]¶
Evaluate the sampled cross-nested logit log probability using NumPy.
- Return type:
float
- logit_choice_avail()[source]¶
Return availability structures appearing in this expression.
- Return type:
list[LogitTuple]