Skip to content

Commit

Permalink
Remove new case threshold and associated docstrings, type hints.
Browse files Browse the repository at this point in the history
  • Loading branch information
jdbeel committed Mar 4, 2025
1 parent 10564bc commit ac6efb9
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 54 deletions.
36 changes: 0 additions & 36 deletions howso/client/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1470,7 +1470,6 @@ def react( # noqa: C901
input_is_substituted: bool = False,
into_series_store: t.Optional[str] = None,
leave_case_out: bool = False,
new_case_threshold: NewCaseThreshold = "min",
num_cases_to_generate: int = 1,
ordered_by_specified_features: bool = False,
post_process_features: t.Optional[Collection[str]] = None,
Expand Down Expand Up @@ -2009,16 +2008,6 @@ def react( # noqa: C901
batched call to react and at the end of reacting. The method is
given a ProgressTimer containing metrics on the progress and timing
of the react operation, and the batch result.
new_case_threshold : str, optional
Distance to determine the privacy cutoff. If None,
will default to "min".
Possible values:
- min: minimum distance in the original local space.
- max: maximum distance in the original local space.
- most_similar: distance between the nearest neighbor to the
nearest neighbor in the original space.
exclude_novel_nominals_from_uniqueness_check : bool, default False
If True, will exclude features which have a subtype defined in their feature
attributes from the uniqueness check that happens when ``generate_new_cases``
Expand All @@ -2039,8 +2028,6 @@ def react( # noqa: C901
ValueError
If `derived_action_features` is not a subset of `action_features`.
If `new_case_threshold` is not one of {"max", "min", "most_similar"}.
If the number of context values does not match the number of context features.
HowsoError
If `num_cases_to_generate` is not an integer greater than 0.
Expand Down Expand Up @@ -2110,13 +2097,6 @@ def react( # noqa: C901
'Specified `derived_action_features` must be a subset of '
'`action_features`.')

if new_case_threshold not in [None, "min", "max", "most_similar"]:
raise ValueError(
f"The value '{new_case_threshold}' specified for the parameter "
"`new_case_threshold` is not valid. It accepts one of the"
" following values - ['min', 'max', 'most_similar',]"
)

if details is not None and 'robust_computation' in details:
details = dict(details)
details['robust_influences'] = details['robust_computation']
Expand Down Expand Up @@ -2180,7 +2160,6 @@ def react( # noqa: C901
"use_case_weights": use_case_weights,
"leave_case_out": leave_case_out,
"preserve_feature_values": preserve_feature_values,
"new_case_threshold": new_case_threshold,
"details": details,
}
else:
Expand Down Expand Up @@ -2220,7 +2199,6 @@ def react( # noqa: C901
"goal_features_map": goal_features_map,
"ordered_by_specified_features": ordered_by_specified_features,
"preserve_feature_values": preserve_feature_values,
"new_case_threshold": new_case_threshold,
"into_series_store": into_series_store,
"input_is_substituted": input_is_substituted,
"substitute_output": substitute_output,
Expand Down Expand Up @@ -2616,7 +2594,6 @@ def react_series( # noqa: C901
input_is_substituted: bool = False,
leave_series_out: bool = False,
max_series_lengths: t.Optional[list[int]] = None,
new_case_threshold: NewCaseThreshold = "min",
num_series_to_generate: int = 1,
ordered_by_specified_features: bool = False,
output_new_series_ids: bool = True,
Expand Down Expand Up @@ -2783,8 +2760,6 @@ def react_series( # noqa: C901
See parameter ``use_case_weights`` in :meth:`AbstractHowsoClient.react`.
preserve_feature_values : iterable of str
See parameter ``preserve_feature_values`` in :meth:`AbstractHowsoClient.react`.
new_case_threshold : str
See parameter ``new_case_threshold`` in :meth:`AbstractHowsoClient.react`.
use_regional_residuals : bool
See parameter ``use_regional_residuals`` in :meth:`AbstractHowsoClient.react`.
feature_bounds_map: dict of dict
Expand Down Expand Up @@ -2817,8 +2792,6 @@ def react_series( # noqa: C901
If `series_context_values` is not a 3d list of objects.
If `derived_action_features` is not a subset of `action_features`.
If `new_case_threshold` is not one of {"max", "min", "most_similar"}.
HowsoError
If `num_series_to_generate` is not an integer greater than 0.
"""
Expand Down Expand Up @@ -2852,13 +2825,6 @@ def react_series( # noqa: C901
serialized_series_context_values.append(
serialize_cases(series, series_context_features, feature_attributes))

if new_case_threshold not in [None, "min", "max", "most_similar"]:
raise ValueError(
f"The value '{new_case_threshold}' specified for the parameter "
"`new_case_threshold` is not valid. It accepts one of the"
" following values - ['min', 'max', 'most_similar',]"
)

# All of these params must be of length 1 or N
# where N is the length of the largest
one_or_more_params = [
Expand Down Expand Up @@ -2901,7 +2867,6 @@ def react_series( # noqa: C901
"goal_features_map": goal_features_map,
"leave_series_out": leave_series_out,
"preserve_feature_values": preserve_feature_values,
"new_case_threshold": new_case_threshold,
"input_is_substituted": input_is_substituted,
"substitute_output": substitute_output,
"weight_feature": weight_feature,
Expand Down Expand Up @@ -2961,7 +2926,6 @@ def react_series( # noqa: C901
"weight_feature": weight_feature,
"use_case_weights": use_case_weights,
"preserve_feature_values": preserve_feature_values,
"new_case_threshold": new_case_threshold,
"details": details,
"series_id_tracking": series_id_tracking,
"output_new_series_ids": output_new_series_ids,
Expand Down
3 changes: 0 additions & 3 deletions howso/client/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,6 @@ class TrainStatus(TypedDict):
Mode: TypeAlias = Literal["robust", "full"]
"""Valid values for ``mode`` parameters."""

NewCaseThreshold: TypeAlias = Literal["max", "min", "most_similar"]
"""Valid values for ``new_case_threshold`` parameters."""

NormalizeMethod: TypeAlias = Literal["fractional_absolute", "fractional", "relative"]
"""Valid values for ``normalize_method`` parameters."""

Expand Down
15 changes: 0 additions & 15 deletions howso/engine/trainee.py
Original file line number Diff line number Diff line change
Expand Up @@ -1196,7 +1196,6 @@ def react(
input_is_substituted: bool = False,
into_series_store: t.Optional[str] = None,
leave_case_out: bool = False,
new_case_threshold: NewCaseThreshold = "min",
num_cases_to_generate: int = 1,
ordered_by_specified_features: bool = False,
preserve_feature_values: t.Optional[Collection[str]] = None,
Expand Down Expand Up @@ -1676,15 +1675,6 @@ def react(
When True and specified along with ``case_indices``, each individual
react will respectively ignore the corresponding case specified
by ``case_indices`` by leaving it out.
new_case_threshold : {"max", "min", "most_similar"}, default "min"
Distance to determine the privacy cutoff.
Possible values:
- min: minimum distance in the original local space.
- max: maximum distance in the original local space.
- most_similar: distance between the nearest neighbor to the nearest
neighbor in the original space.
num_cases_to_generate : int, default 1
The number of cases to generate.
ordered_by_specified_features : bool, default False
Expand Down Expand Up @@ -1748,7 +1738,6 @@ def react(
input_is_substituted=input_is_substituted,
into_series_store=into_series_store,
leave_case_out=leave_case_out,
new_case_threshold=new_case_threshold,
num_cases_to_generate=num_cases_to_generate,
ordered_by_specified_features=ordered_by_specified_features,
post_process_features=post_process_features,
Expand Down Expand Up @@ -1783,7 +1772,6 @@ def react_series(
input_is_substituted: bool = False,
leave_series_out: bool = False,
max_series_lengths: t.Optional[list[int]] = None,
new_case_threshold: NewCaseThreshold = "min",
num_series_to_generate: int = 1,
ordered_by_specified_features: bool = False,
output_new_series_ids: bool = True,
Expand Down Expand Up @@ -1884,8 +1872,6 @@ def react_series(
with ``continue_series``, this defines the maximum length of the
forecast. Must provide either one for all series, or exactly
one per series.
new_case_threshold : str, optional
See parameter ``new_case_threshold`` in :meth:`react`.
num_series_to_generate : int, default 1
The number of series to generate when desired conviction is specified.
ordered_by_specified_features : bool, default False
Expand Down Expand Up @@ -1979,7 +1965,6 @@ def react_series(
initial_batch_size=initial_batch_size,
input_is_substituted=input_is_substituted,
max_series_lengths=max_series_lengths,
new_case_threshold=new_case_threshold,
num_series_to_generate=num_series_to_generate,
ordered_by_specified_features=ordered_by_specified_features,
output_new_series_ids=output_new_series_ids,
Expand Down

0 comments on commit ac6efb9

Please sign in to comment.