scikit-rebate icon indicating copy to clipboard operation
scikit-rebate copied to clipboard

TuRF doesn't work with odd number of features

Open jgoecks opened this issue 6 years ago • 1 comments

When the number of features is odd, TuRF often leaves out one feature (causing a value error at this line https://github.com/EpistasisLab/scikit-rebate/blob/master/skrebate/turf.py#L166) because segmenting of features into selected and non_selected is based on the number of features to retain: https://github.com/EpistasisLab/scikit-rebate/blob/master/skrebate/turf.py#L131

This code fixes the problem for me:

num_features_non_select = len(features_iter[iter_count]) - num_features
non_select = np.array(features_iter[iter_count].argsort()[:num_features_non_select])

jgoecks avatar Aug 21 '18 23:08 jgoecks

Hi,

I'm an undergraduate at Penn working on this project; could you provide the data you used that caused this error? Thank you!

alexmxu avatar Sep 13 '18 16:09 alexmxu