sklearn::TypeError: Wrong type for parameter `n_values`. Expected 'auto', int or array of ints, got
n_values should only contain domain sizes for categorical values completely skipping out the non-categorical columns in the data matrix.
Therefore if [True, False, True] format is used, the size should correspond to the number of True values in the array or if indices are used the two arrays should be of the same size.
So there should be no None values but also no 0s, -1s or any other ways to encode real-valued variables in the n_values array.
I am passing in a hardcoded list / tuple (tried both) when initialising the OneHotEncoder and I get this error during fit_transform , not using numpy types anywhere (well except for the data matrix itself).
The only thing is that some of the values in that array are None because I am also using categorical_features to specify a mask (as in some of the features are real-valued and I want them to stay real-valued.
My n_values looks like [1, 2, 3, None, 5] or (1, 2, 3, None, 5) and
my categorical_features looks like [0, 1, 2, 4] though I have also tried:
[True, True, True, False, True].
The documentation does not present any actual examples with the mask on.
EDIT:
So, I tried replacing None with zeroes and this issue went away but now I get:
ValueError: Shape mismatch: if n_values is an array, it has to be of shape (n_features,).
Whether I wrap my mask array with np.array or not (and when I do the shape is indeed the same as (n_features,)) I get this same error (though interestingly it does not complain about it being a numpy array anymore as long as there are no None values in it.