mil
mil copied to clipboard
`mil_vision.ContourClassifier` ABC has a type error
The mil_vision.ContourClassifier
has a type error in the read_from_csv
method:
def read_from_csv(self, training_file: Optional[str] = None):
"""
Return features and classes from specified training file.
"""
training_file = _get_param(training_file, self.training_file)
df = pandas.read_csv(training_file)
classes = df.values[:, 1]
features = df.values[:, 2:]
return features, classes
Currently, the ABC allows a None
value to be input for the training_file
parameter (this makes sense since it's a non-implemented ABC). However, this causes a few type issues. The pandas.read_csv
file will break if None
is passed in. Therefore, this needs to be fixed.
One solution could be adding raise NotImplemented
if training_file == None
. This would be expected from an ABC, and would mitigate the error. If this is implemented, the child classes will need to be examined to make sure that this won't break any behavior.