Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a convenience function for listing status of each detector in ensembles #133

Closed
tms-bananaquit opened this issue Jan 30, 2023 · 2 comments · Fixed by #142
Closed

Add a convenience function for listing status of each detector in ensembles #133

tms-bananaquit opened this issue Jan 30, 2023 · 2 comments · Fixed by #142
Assignees
Labels
enhancement New feature or request
Projects

Comments

@tms-bananaquit
Copy link
Collaborator

tms-bananaquit commented Jan 30, 2023

This should about do it. Would be useful for diagnosing behavior.

class Ensemble:
...
  @property
  def drift_state_dict(self):
  """ The ensemble members' current drift states."""
      return {detector_name : det.drift_state for detector_name, det in self.detectors.items()}
...
@tms-bananaquit
Copy link
Collaborator Author

And for retraining recommendations..

class Ensemble:
...
  @property
  def retraining_recs_dict(self):
  """ The ensemble members' current retraining recommendations."""
      output = {}
      for detector_name, det in self.detectors.items():
            if hasattr(det, 'retraining_recs'):
                  output[detector_name] = det.retraining_recs
      return output
...

I think this could also be a one-liner list comprehension, but this is easier to read.

@tms-bananaquit
Copy link
Collaborator Author

tms-bananaquit commented Jan 30, 2023

There's probably a better way to implement this abstractly for StreamingEnsemble and BatchEnsemble, that will spit out dicts for properties defined there. retraining_recs is probably the only oddball, as it's not defined in detector.py.

More straightforward (and readable?) to dupe this sort of code for the ones we want, though.

@Anmol-Srivastava Anmol-Srivastava self-assigned this Mar 21, 2023
@Anmol-Srivastava Anmol-Srivastava added the enhancement New feature or request label Mar 21, 2023
@Anmol-Srivastava Anmol-Srivastava added this to To do in Ver 0.2.1 via automation Mar 21, 2023
@Anmol-Srivastava Anmol-Srivastava linked a pull request Mar 21, 2023 that will close this issue
Ver 0.2.1 automation moved this from To do to Done Mar 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Development

Successfully merging a pull request may close this issue.

2 participants