Attributeerror While Implementing Famd With Smotenc In A Imblearn Pipeline
Solution 1:
tl;dr: try adding sparse=False
to your OneHotEncoder
. Consider raising an Issue with prince
, to handle sparse inputs.
You can see from the traceback that the problem is that FAMD.fit
tries X.select_dtypes
to separate categorical and numeric data. select_dtypes
is a pandas function, so normally I would assume that prince
is written to operate on dataframes and not the numpy arrays that sklearn uses internally (after converting from frames if necessary). However, looking at the source, a few lines above that one they do convert from numpy array to dataframe. But, the last trace message is from scipy. That hints that your X
may actually be a sparse array. And indeed OneHotEncoder
(earlier in your pipeline) prefers to output sparse arrays, and ColumnTransformer
determines whether to transform into sparse or dense depending on its component parts and the parameter sparse_threshold
.
Post a Comment for "Attributeerror While Implementing Famd With Smotenc In A Imblearn Pipeline"