Skip to content
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

18963: Removes deprecated dropna feature attribute, MAJOR #103

Merged
merged 3 commits into from
Jan 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions howso/utilities/feature_attributes/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,6 @@ class InferFeatureAttributesBase(ABC):
def _process(self, # noqa: C901
features: Optional[Dict[str, Dict]] = None,
infer_bounds: bool = True,
dropna: bool = False,
tight_bounds: Optional[Iterable[str]] = None,
mode_bound_features: Optional[Iterable[str]] = None,
id_feature_name: Optional[Union[str, Iterable[str]]] = None,
Expand All @@ -478,11 +477,6 @@ def _process(self, # noqa: C901
else:
tight_bounds = None

if dropna:
warnings.warn("The 'dropna' parameter is deprecated and will be removed in "
"a future release. Please explicitly filter your data.",
DeprecationWarning)

if features and not isinstance(features, dict):
raise ValueError(
f"The parameter `features` needs to be a `dict` and not of "
Expand Down Expand Up @@ -670,13 +664,6 @@ def _process(self, # noqa: C901
if bounds:
feature_attributes[feature_name]['bounds'] = bounds # noqa

if dropna:
for feature_name in feature_attributes:
if 'dropna' in feature_attributes[feature_name]:
# Don't override user's preference
continue
feature_attributes[feature_name]['dropna'] = True # noqa

# Do any features contain data unsupported by the core?
self._check_unsupported_data(feature_attributes)

Expand Down
8 changes: 2 additions & 6 deletions howso/utilities/feature_attributes/time_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ def _set_rate_delta_bounds(self, btype: str, bounds: Dict, features: Dict):
def _process( # noqa: C901
self,
features: Optional[Dict] = None,
infer_bounds: bool = True, dropna: bool = False,
infer_bounds: bool = True,
id_feature_name: Optional[Union[str, Iterable[str]]] = None,
time_invariant_features: Optional[Iterable[str]] = None,
datetime_feature_formats: Optional[Dict] = None,
Expand Down Expand Up @@ -547,7 +547,6 @@ def _process( # noqa: C901
features = infer(
features=features,
infer_bounds=infer_bounds,
dropna=dropna,
datetime_feature_formats=datetime_feature_formats,
attempt_infer_extended_nominals=attempt_infer_extended_nominals,
nominal_substitution_config=nominal_substitution_config,
Expand All @@ -574,11 +573,10 @@ def _process( # noqa: C901
else:
id_feature_names = []

# ID features are time-invariant and cannot be NaN.
# ID features are time-invariant.
for id_feature in id_feature_names:
if id_feature not in time_invariant_features:
time_invariant_features.append(id_feature)
features[id_feature]["dropna"] = True

if self.time_feature_name in time_invariant_features:
raise ValueError('time_feature_name cannot be in the '
Expand Down Expand Up @@ -636,8 +634,6 @@ def _process( # noqa: C901
# Time feature might have `sensitive` and `subtype` attribute
# which is not applicable to time feature.
features[self.time_feature_name].pop('subtype', None)
# The time feature cannot be NaN, so set dropna to True.
features[self.time_feature_name]["dropna"] = True

# if the time feature has no datetime and is stored as a string,
# convert to an int for comparison since it's continuous
Expand Down