Repository navigation
Conversation
riedgar-ms
left a comment
There was a problem hiding this comment.
Thank you for trying again at this!
| self._sample_params = self._concat_if_not_none(self._sample_params, | ||
| sample_params) | ||
|
|
||
| def get_metric(self) -> MetricFrame: |
There was a problem hiding this comment.
Perhaps evaluate_metrics() ? @MiroDudik @hildeweerts @adrinjalali ?
There was a problem hiding this comment.
that's a good question. Somehow I was thinking of this being sth that I could add data to, and then call .evaluate() which either returns nothing or self, and it would have all the features like MetrifFrame. If we don't want to go down that path, I think get_metricframe would be what this does?
| check_consistent_length(y_true, y_pred) | ||
| self._y_true = self._concat_if_not_none(self._y_true, y_true) | ||
| self._y_pred = self._concat_if_not_none(self._y_pred, y_pred) | ||
| self._sensitive_features = self._concat_if_not_none(self._sensitive_features, |
There was a problem hiding this comment.
Should sensitive features be checked for consistent length?
|
|
||
| if sample_params is not None: | ||
| self._sample_params = self._concat_if_not_none(self._sample_params, | ||
| sample_params) |
There was a problem hiding this comment.
Shouldn't this have an else clause like the control features? And a consistent length check?
| self._sensitive_features = self._concat_if_not_none(self._sensitive_features, | ||
| sensitive_features) | ||
| if control_features is not None: | ||
| self._control_features = self._concat_if_not_none(self._control_features, |
|
At a first glance it seems like @Dref360 has processed al requested changes from @riedgar-ms. Is there anything else that's blocking this PR from getting merged? Tagging @fairlearn/fairlearn-maintainers |
adrinjalali
left a comment
There was a problem hiding this comment.
Otherwise LGTM, except that I'm not happy that we don't have codecov and I can't check if tests cover the new code. I guess I should set it up.
| " because it was initialized as such.") | ||
|
|
||
| # A TypeVar to express possible batch types. | ||
| B = TypeVar('B', Dict, np.ndarray, List, pd.Series, pd.DataFrame) |
There was a problem hiding this comment.
then call it a BachtType maybe?
| self._control_features = None | ||
| self._sample_params = None | ||
|
|
||
| def reset(self): |
There was a problem hiding this comment.
would the user not create a new StreamingMetricFrame instead?
| sensitive_features : (List, pandas.Series, dict of 1d arrays, | ||
| numpy.ndarray, pandas.DataFrame) |
There was a problem hiding this comment.
we could just 1D or 2D say array-like instead?
| check_consistent_length(y_true, y_pred) | ||
| check_consistent_length(y_true, sensitive_features) |
There was a problem hiding this comment.
you could merge these calls and pass the three objects
Introduce StreamingMetricFrame to accumulate batches and enable batch evaluation.
This version focuses on maintainability and is much easier to work with than the previous one. Most checks are now done by MetricFrame.
Fixes #655
Notes
In the previous PR (#670), we mentioned that converting everything to pandas would be valuable.
I think this would be useful, but this approach gets complicated with nested dict found in
sample_params. I am open to propositions on how to fix that and maybe get rid ofStreamingMetricFrame._concat_batches.