Skip to content

Two bugs in filter_features #598

@desilinguist

Description

@desilinguist

There are two issues with filter_features:

  1. Any labels specified with -L or --label are assumed to be strings. This will not always work because when reading in feature file, we will convert labels to floats or ints whenever possible. So, if the labels are, for example, 0 and 1, then filter_features -L 0 1 will never work.

    Note that filtering via the API (using FeatureSet.filter()) works just fine so this just an issue with the command-line script itself.

  2. The argument parsing for filter_features is strange because several options have nargs='*' which makes it so that the input file and output file have to be specified first before any of these options.

The fixes for both these issues are simple:

  1. We should be calling safe_float() on the labels parsed in filter_features so that these labels are converted in the exact same way as the labels when the feature file is read in.

  2. We need to switch to using nargs='+' and use the required keyword argument.

Another thing to note that since 1 was never caught with current tests, we have a gap in our filter_features tests which should be patched.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions