refine#

fastcan.refine(selector, drop=1, max_iter=None, verbose=1)#

Two-stage refining for the results of fastcan.FastCan.

In the refining process, the selected features will be dropped, and the vacancy positions will be refilled from the candidate features.

The processing of a vacant position is refilled after searching all candidate features is called an iteration.

The processing of a vacant position is refilled by a different features from the dropped one, which increase the SSC of the selected features is called a valid iteration.

Parameters:
  • selector (FastCan) – FastCan selector.

  • drop (int or array-like of shape (n_drops,) or "all", default=1) – The number of the selected features dropped for the consequent reselection.

  • max_iter (int, default=None) – The maximum number of valid iterations in the refining process.

  • verbose (int, default=1) – The verbosity level.

Returns:

  • indices (ndarray of shape (n_features_to_select,), dtype=int) – The indices of the selected features.

  • scores (ndarray of shape (n_features_to_select,), dtype=float) – The h-correlation/eta-cosine of selected features.

References

  • Zhang L., Li K., Bai E. W. and Irwin G. W. (2015).

    Two-stage orthogonal least squares methods for neural network construction. IEEE Transactions on Neural Networks and Learning Systems, 26(8), 1608-1621.

Examples

>>> from fastcan import FastCan, refine
>>> X = [[1, 1, 0], [0.01, 0, 0], [-1, 0, 1], [0, 0, 0]]
>>> y = [1, 0, -1, 0]
>>> selector = FastCan(2, verbose=0).fit(X, y)
>>> print(f"Indices: {selector.indices_}", f", SSC: {selector.scores_.sum():.5f}")
Indices: [0 1] , SSC: 0.99998
>>> indices, scores = refine(selector, drop=1, verbose=0)
>>> print(f"Indices: {indices}", f", SSC: {scores.sum():.5f}")
Indices: [1 2] , SSC: 1.00000