Skip to content

TuRF doesn't work with odd number of features #54

@jgoecks

Description

@jgoecks

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])

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions