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
AverageLearner1D added #283
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is really great! I am super excited to use this 🎉
I have made some style changes and I left some small comments.
Todo:
- add tests
- add tutorial in the right format
The AverageLearner1D has been added to the master branch (two changes were made: Learner1D._update_data_structures() does not exist anymore, so we modified AverageLearner1D accordingly; also, self._data was changed to self.data). Tutorial notebook added (tutorial_averagelearner1d_aux.py contains some auxiliary functions for the tutorial). The __init__.py files of adaptive/ and learner/, and notebook_integration.py were modified to include the AverageLearner1D.
The old version was bugged (it rewrote learner data and raised errors when ran repeatedly). The new version worked well in all tests we perfomed. Doc-string also fixed.
This method now matches the definition from the BaseLearner. It provides a computational efficiency in some scenarios (see the comments in the code), otherwise it just performs a loop with a tell(x,y)
The docs and tutorial have been updated to include the AverageLearner1D. The previous tutorial (Python notebook) has been replaced by new tutorial as .rst file.
The new value of the data at point adopted the value of the mean of the new data samples, instead of the mean over all samples (new and old). Fixed!
When testing this I realized that the function is not deterministic (does not take a seed). I am implementing that the function signature of the function-to-learn is: |
Well spotted, thanks! |
I am fixing the remaining (2) failing tests.
e.g.:
returns
for an empty learner. With data: With data it is:
|
I have fixed all the tests! 🎉 I have also enabled auto-merge. It's now in a working state, we can make more changes in subsequent PRs. @AlvaroGI, really great work! |
That’s great news!! 🎉 Thank you for all your work, it looks so neat now! 😄 |
The AverageLearner1D has been added to the master branch (original code with design details and tests can be found here).
Tutorial notebook added (tutorial_averagelearner1d_aux.py contains some auxiliary functions for the tutorial).
Changes in existing files
The init.py files of adaptive/ and learner/, and notebook_integration.py were only modified to include the AverageLearner1D.