Skip to main content

predict_multinomial_formula

Function predict_multinomial_formula 

Source
pub fn predict_multinomial_formula(
    model: &MultinomialSavedModel,
    data: &EncodedDataset,
) -> Result<Array2<f64>, EstimationError>
Expand description

Replay the saved termspec to build the predict-time design on a fresh dataset, then evaluate the POSTERIOR-MEAN class probabilities E[softmax(x'β) | data]. The predict dataset must carry the same feature columns the training data did, matched by name — it need not reproduce the training column order, and in particular need not carry the response column (prediction is for label-free new data).

The posterior mean is computed as a ratio of normalising constants rather than by integrating softmax over the Laplace Gaussian; see crate::multinomial_predictive for why the latter is not an approximation of this estimand (#2612). For the plug-in softmax(x'β̂) every other softmax implementation reports, ask predict_multinomial_formula_plugin by name.