Skip to content

Commit

Permalink
Add get_prediction_stats to Pandas client.
Browse files Browse the repository at this point in the history
  • Loading branch information
jdbeel committed Nov 6, 2024
1 parent 98c1703 commit bc6ee48
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions howso/client/pandas/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,10 @@ def get_feature_conviction(self, *args, **kwargs) -> DataFrame:
rows.append(response['familiarity_conviction_removal'])
return deserialize_to_dataframe(rows, index=index)

def get_prediction_stats(self, trainee_id: str, *args, **kwargs) -> DataFrame:
"""Calls :meth:`react_aggregate` and returns the results as a `DataFrame`."""
return DataFrame(super().react_aggregate(trainee_id, *args, **kwargs)).T

def get_marginal_stats(self, *args, **kwargs) -> DataFrame:
"""
Base: :func:`howso.client.AbstractHowsoClient.get_marginal_stats`.
Expand Down
5 changes: 4 additions & 1 deletion howso/engine/trainee.py
Original file line number Diff line number Diff line change
Expand Up @@ -3196,7 +3196,10 @@ def react_aggregate(

def get_prediction_stats(self, *args, **kwargs) -> DataFrame:
"""Calls :meth:`react_aggregate` and returns the results as a `DataFrame`."""
return DataFrame(self.react_aggregate(*args, **kwargs)).T
if isinstance(self.client, HowsoPandasClientMixin):
return super().get_prediction_stats(self.id, *args, **kwargs)
else:
raise AssertionError("Client must have the `get_prediction_stats` method.")

def get_params(
self,
Expand Down

0 comments on commit bc6ee48

Please sign in to comment.