Skip to content

Commit

Permalink
21302: Supports experimental output from reduce_data, MINOR (#266)
Browse files Browse the repository at this point in the history
  • Loading branch information
jdbeel authored Aug 21, 2024
1 parent 210d56a commit a3547a9
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
15 changes: 13 additions & 2 deletions howso/client/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -3987,7 +3987,7 @@ def reduce_data(
influence_weight_entropy_threshold: t.Optional[float] = None,
skip_auto_analyze: bool = False,
**kwargs,
):
) -> dict:
"""
Smartly reduce the amount of trained cases while accumulating case weights.
Expand Down Expand Up @@ -4021,6 +4021,12 @@ def reduce_data(
which defaults to 0.6.
skip_auto_analyze : bool, default False
Whether to skip auto-analyzing as cases are removed.
Returns
-------
dict
A dictionary for reporting experimental outputs of reduce data. Currently, the default
non-experimental output is an empty dictionary.
"""
trainee_id = self._resolve_trainee(trainee_id).id
params = dict(
Expand All @@ -4038,7 +4044,12 @@ def reduce_data(
UnsupportedArgumentWarning)
if self.configuration.verbose:
print(f'Reducing data on Trainee with id: {trainee_id}')
self.execute(trainee_id, "reduce_data", params)
result = self.execute(trainee_id, "reduce_data", params)

if result is None:
return dict()

return result

def get_cases(
self,
Expand Down
10 changes: 8 additions & 2 deletions howso/engine/trainee.py
Original file line number Diff line number Diff line change
Expand Up @@ -783,7 +783,7 @@ def reduce_data(
influence_weight_entropy_threshold: t.Optional[float] = None,
skip_auto_analyze: bool = False,
**kwargs,
):
) -> dict:
"""
Smartly reduce the amount of trained cases while accumulating case weights.
Expand Down Expand Up @@ -817,9 +817,15 @@ def reduce_data(
which defaults to 0.6.
skip_auto_analyze : bool, default False
Whether to skip auto-analyzing as cases are removed.
Returns
-------
dict
A dictionary for reporting experimental outputs of reduce data. Currently, the default
non-experimental output is an empty dictionary.
"""
if isinstance(self.client, AbstractHowsoClient):
self.client.reduce_data(
return self.client.reduce_data(
trainee_id=self.id,
features=features,
distribute_weight_feature=distribute_weight_feature,
Expand Down

0 comments on commit a3547a9

Please sign in to comment.