modAL
modAL copied to clipboard
_add_training_data and _fit_on_new does not work with custom data types
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.
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.