biogeme.expressions.panel_log_likelihood module¶
- class biogeme.expressions.panel_log_likelihood.PanelLogLikelihood(child)[source]¶
Bases:
ExpressionAggregate per-observation log-probabilities into per-individual log-likelihoods.
This expression assumes its child evaluates, for a given dataframe, to a 1-D tensor of shape
(obs,)containing the log-probability of each observation. It then sums these log-probabilities within each individual (panel) and returns a 1-D tensor of shape(indiv,).Notes¶
Intended for Bayesian estimation with PyMC, which operates in log-space.
The panel/individual id column name is taken from
self.panel_index_nameif available, otherwise it defaults to'ID'.A coord named
Dimension.INDIVIDUALSis created on the active PyMC model if it does not yet exist, to label the individuals’ axis.
- type child:
Expression|float|int|bool- param child:
Expression that returns per-observation log-probabilities when evaluated by the PyMC builder.
- deep_flat_copy()[source]¶
Return a deep/flat copy of the expression.
- Return type:
- Returns:
A structurally independent copy whose child is a deep/flat copy.
- Parameters:
child (ExpressionOrNumeric)