Cross-view regression imputation

One multi-output regressor is fitted per view, mapping the concatenation of all other views onto it, using the samples for which the target view is observed. Where nearest-neighbour imputation copies real samples, this learns an explicit view-to-view mapping, which is usually the stronger choice when the views are close to linearly related and few complete samples are available.

Regression-based imputation of a view from the other views.

class polyview.imputation.cross_view.CrossViewRegressionImputer(*args: Any, **kwargs: Any)

Bases: BaseViewImputer

Predict each missing view from the views that are available.

One multi-output regressor is fitted per view, mapping the concatenation of all other views onto it, using the samples for which the target view is observed. At transform time, samples missing that view get the model’s prediction. Where KNNViewImputer copies real samples, this learns an explicit view-to-view mapping, which is usually the stronger choice when the views are close to linearly related and the number of complete samples is small.

The predictor block is mean-filled and standardised before the fit, so a sample missing two views out of three can still be reconstructed.

Parameters:
  • estimator (sklearn regressor or None, default=None) – Multi-output regressor, cloned once per view. None uses sklearn.linear_model.Ridge with alpha=1.0, whose regularisation matters here because neighbouring views are often collinear.

  • estimator_params (dict or None, default=None) – Extra parameters set on each clone, e.g. {"alpha": 10.0}.

  • n_views (int or None, default=None) – Expected number of views. None accepts any count.

estimators_

Fitted regressor per view; None for views that could not be modelled (see Notes).

Type:

list of estimator or None

n_train_samples_

Number of samples each view’s regressor was fitted on.

Type:

ndarray of shape (n_views,)

missing_view_mask_

True where a whole view was missing at fit time.

Type:

ndarray of bool of shape (n_samples, n_views)

missing_rate_

Fraction of fit samples for which each view was missing.

Type:

ndarray of shape (n_views,)

Notes

A view’s regressor is skipped, and the column mean used instead, when there is a single view in total or when fewer than two fit samples have that view observed.

Examples

>>> import numpy as np
>>> from polyview.imputation import CrossViewRegressionImputer
>>> rng = np.random.default_rng(0)
>>> X1 = rng.normal(size=(50, 3))
>>> X2 = X1 @ rng.normal(size=(3, 2))      # view 2 is a function of view 1
>>> X2[:5] = np.nan                        # five samples lost view 2
>>> filled = CrossViewRegressionImputer().fit_transform([X1, X2])
>>> bool(np.isnan(filled[1]).any())
False