You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am currently experiencing some weird errors while trying to port a pipeline from sklearn to dask. With respect to the SimpleImputer preprocessing class, I have noticed that the most_frequent strategy is currently implemented in such a way that the result is not what I think it should be. It reads:
def _fit_frame(self, X):
if self.strategy == "mean":
avg = X.mean(axis=0).values
elif self.strategy == "median":
avg = X.quantile().values
elif self.strategy == "constant":
avg = np.full(len(X.columns), self.fill_value)
else:
avg = [X[col].value_counts().nlargest(1).values for col in X.columns]
avg = np.concatenate(*dask.compute(avg))
self.statistics_ = pd.Series(dask.compute(avg)[0], index=X.columns)
My problem is with the following line:
avg = [X[col].value_counts().nlargest(1).values for col in X.columns]
I have been debugging this part and the previous line returns the counts for the most frequent item, not the item itself, which can introduce some weird errors when dealing with categorical data.
Does anybody have an explanation for this? Or did I miss something? Any hint will be much appreciated.
Regards.
Gus.
The text was updated successfully, but these errors were encountered:
Hi,
I am currently experiencing some weird errors while trying to port a pipeline from sklearn to dask. With respect to the SimpleImputer preprocessing class, I have noticed that the most_frequent strategy is currently implemented in such a way that the result is not what I think it should be. It reads:
My problem is with the following line:
I have been debugging this part and the previous line returns the counts for the most frequent item, not the item itself, which can introduce some weird errors when dealing with categorical data.
Does anybody have an explanation for this? Or did I miss something? Any hint will be much appreciated.
Regards.
Gus.
The text was updated successfully, but these errors were encountered: