modAL icon indicating copy to clipboard operation
modAL copied to clipboard

_add_training_data and _fit_on_new does not work with custom data types

Open jangedoo opened this issue 5 years ago • 1 comments

I have a sklearn pipeline that accepts custom data type as input but it when I use that pipeline and teach the learner, I get the following error TypeError: float() argument must be a string or a number, not 'MyClass'

I traced the problem back to check_X_y function used in BaseLearner. I added dtype=None so that it preserves the input type instead of trying to convert it to a numeric and it didn't throw any errors and works as expected.

I think that behaviour should be expected instead of it trying to convert our data types for us.

jangedoo avatar Jun 18 '19 16:06 jangedoo

Thanks, you are completely right! I have added dtype=None arguments for all check_X_y calls, will add a test soon to ensure that working with custom data types won't break in the future.

cosmic-cortex avatar Jun 19 '19 05:06 cosmic-cortex