Late Fusion

Late fusion combines per-view predictions (for example, one prediction vector per modality) into a final output. This module includes weighted majority voting. The reusable base class lives in polyview.base.

class polyview.fusion.late.MajorityVote(*args: Any, **kwargs: Any)

Bases: BaseLateFusion

Fuse per-view discrete predictions with sample-wise majority vote.

Parameters:
  • weights (sequence of float or None, default=None) – Optional non-negative per-view weights. If None, each view gets weight 1.0. Must have one value per view.

  • tie_break ({"first", "random"}, default="first") – Strategy used when multiple classes receive the same max vote. - “first”: choose the smallest class label among tied classes. - “random”: choose a random tied class (reproducible via random_state).

  • random_state (int or None, default=None) – Seed used only when tie_break='random'.

  • align_labels (bool, default=False) – If True, the labels of each view are first permuted to best match those of the first view (Hungarian algorithm on their contingency table). Use it when the per-view predictions are clusterings, whose label identifiers are arbitrary in each view.

fit(preds_by_view: List[Iterable], y=None) → MajorityVote

Fit the late-fusion model from per-view predictions.

Parameters:
  • preds_by_view (list of array-like) – One 1-D prediction vector per view.

  • y (ignored)

Return type:

self

fit_predict(preds_by_view: List[Iterable], y=None) → numpy.ndarray

Fit and immediately fuse predictions.

Parameters:
  • preds_by_view (list of array-like) – One 1-D prediction vector per view.

  • y (ignored)

Returns:

Fused prediction vector.

Return type:

ndarray of shape (n_samples,)

predict(preds_by_view: List[Iterable]) → numpy.ndarray

Fuse per-view predictions into a single prediction.

Parameters:

preds_by_view (list of array-like) – One 1-D prediction vector per view.

Returns:

Fused prediction vector.

Return type:

ndarray of shape (n_samples,)