ols#

fastcan.utils.ols(X, y, t=1)#

Orthogonal least-squares.

Parameters:
  • X (array-like of shape (n_samples, n_features)) – Feature matrix.

  • y (array-like of shape (n_samples,)) – Target vector.

  • t (int, default=1) – The parameter is the absolute number of features to select.

Returns:

  • indices (ndarray of shape (n_features_to_select,), dtype=int) – The indices of the selected features. The order of the indices is corresponding to the feature selection process.

  • scores (ndarray of shape (n_features_to_select,), dtype=float) – The scores of selected features. The order of the scores is corresponding to the feature selection process.

Examples

>>> from fastcan.utils import ols
>>> X = [[1, 0, 0], [0, 1, 0], [0, 0, 1], [0, 0, 0]]
>>> y = [1, 0, 1, 0]
>>> indices, scores = ols(X, y, 2)
>>> indices
array([0, 2])
>>> scores
array([0.5, 0.5])