Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


RFECV step option broken #1771

duschendestroyer opened this Issue · 2 comments

4 participants


the scores array is always initialized to np.zeros(X.shape[1]), but with a step != 1 less scores are collected. The trailing zeros lead to the false number of features being selected.


Thanks for the report.
I vaguely remember a problem here, maybe I messed this up when trying to fix it. Need to run blame...


The scores array needs to be of shape [n_subsets_of_features] to be true to its documentation. As of right now it is still X.shape[1]. Note that n_subsets_of_features=int(np.ceil((n_features-n_features_to_select)/float(step))) + 1. It is not the 'trailing zeros' that leads to the wrong number of features being selected but rather the k+1 on line 358 If 0 < step < 1, n_features_to_select = int(self.step * n_features)*k+1 and if step >= 1, n_features_to_select = int(self.step)*k+1.

@amueller amueller modified the milestone: 0.15.1, 0.15
@agramfort agramfort closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.