NestedLogit.calc_conditional_prob#
- NestedLogit.calc_conditional_prob(U, lambdas, nest_idx, nest_name, nest_indices, alphas_nest)[source]#
Calculate conditional probability within a nest.
This implements the scaled softmax probability within a nest: P(y_i = j | j ∈ nest) = exp(U_ij / λ) / Σ_{k ∈ nest} exp(U_ik / λ)
- Parameters:
- U
TensorVariable Systematic utility, shape (n_obs, n_alts)
- lambdas
TensorVariable Nest-specific lambda parameters
- nest_idx
int Index of current nest in lambda array
- nest_name
str Name of the nest
- nest_indices
dict Mapping of nest names to alternative indices
- U
- Returns:
- exp_W_nest
TensorVariable Exponentiated inclusive value for the nest, shape (n_obs,)
- P_y_given_nest
TensorVariable Conditional probabilities within the nest, shape (n_obs, n_alts_in_nest)
- exp_W_nest