-
Notifications
You must be signed in to change notification settings - Fork 2
Fix 13 : Create SimpleImputer #14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not a method that is a drop in replacement of SimpleImputer in sklearn with similar interface. It looks like you accidentally submitted rough notes?
sorry for this issue , please check now . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are using the numpy methods here and should be using the DP versions from this package - should be a small change
diffprivlib/SimpleImputer
Outdated
|
||
def _impute_mean(self, col, missing_col): | ||
non_missing_values = col[~missing_col] | ||
col_mean = np.nanmean(non_missing_values) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you are using nanmean from numpy... shouldn't you use the dp version from this library ;)
|
||
def _impute_median(self, col, missing_col): | ||
non_missing_values = col[~missing_col] | ||
col_median = np.nanmedian(non_missing_values) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you are using nanmedian from numpy... shouldn't you use the dp version from this library ;)
def _impute_median(self, col, missing_col): | ||
non_missing_values = col[~missing_col] | ||
col_median = np.nanmedian(non_missing_values) | ||
sensitivity = np.nanmax(np.abs(non_missing_values - col_median)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you are using nanmax from numpy... shouldn't you use the dp version from this library ;)
diffprivlib/SimpleImputer
Outdated
elif self.strategy == 'constant': | ||
self.statistics_ = [self.fill_value] * X.shape[1] | ||
else: | ||
self.statistics_ = [np.nanmean(col) if np.issubdtype(col.dtype, np.number) else np.nan for col in X.T] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you are using nanmean from numpy... shouldn't you use the dp version from this library ;)
Sorry bhaiya , i think there is no nanmax and nanmedium functions in this lib . Can you please check it once . |
added nan medium and updated bounds in quantile function
No description provided.