-
Notifications
You must be signed in to change notification settings - Fork 68
Description
There are two issues with filter_features:
-
Any labels specified with
-Lor--labelare 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, thenfilter_features -L 0 1will 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. -
The argument parsing for
filter_featuresis strange because several options havenargs='*'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:
-
We should be calling
safe_float()on the labels parsed infilter_featuresso that these labels are converted in the exact same way as the labels when the feature file is read in. -
We need to switch to using
nargs='+'and use therequiredkeyword 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.