From a3547a976ec406f663a4264cb923687dcc67ef04 Mon Sep 17 00:00:00 2001 From: Jacob Beel <54082169+jdbeel@users.noreply.github.com> Date: Wed, 21 Aug 2024 11:19:22 -0400 Subject: [PATCH] 21302: Supports experimental output from reduce_data, MINOR (#266) --- howso/client/base.py | 15 +++++++++++++-- howso/engine/trainee.py | 10 ++++++++-- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/howso/client/base.py b/howso/client/base.py index 8ff7c23a..8cc828ff 100644 --- a/howso/client/base.py +++ b/howso/client/base.py @@ -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. @@ -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( @@ -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, diff --git a/howso/engine/trainee.py b/howso/engine/trainee.py index cfe99781..12fe97e9 100644 --- a/howso/engine/trainee.py +++ b/howso/engine/trainee.py @@ -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. @@ -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,