MaxDiffMixedLogit.transform_attributes#

MaxDiffMixedLogit.transform_attributes(new_attrs)[source]#

Apply the fitted patsy formula to a new attribute frame.

Use this to score hypothetical items that were not in the training pool. Returns a (n_rows, n_features) numpy array whose columns align with self.feature_names — multiplying by a posterior draw of beta_feat gives the posterior of the new items’ utilities.

Parameters:
new_attrspd.DataFrame

One row per hypothetical item, with the same attribute columns as the training item_attributes.

Raises:
RuntimeError

If called on a non-part-worths model (no design info to apply).