-
Notifications
You must be signed in to change notification settings - Fork 89
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
Refactor: Remove Cython - Reduce tech debt #346
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #346 +/- ##
==========================================
+ Coverage 73.54% 78.91% +5.37%
==========================================
Files 29 45 +16
Lines 2831 4767 +1936
Branches 629 1005 +376
==========================================
+ Hits 2082 3762 +1680
- Misses 632 806 +174
- Partials 117 199 +82 ☔ View full report in Codecov by Sentry. |
For everyone else being stuck due to type errors etc:
Might help in your case. |
@@ -0,0 +1,337 @@ | |||
from __future__ import annotations |
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.
I think all the classes in this file require a docstring. Without a docstring it is completely unclear what they do, and why this abstraction is necessary.
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.
The reason for the abstraction of things in this file is that a lot of methods for the hyperparameters were essentially doing the same things, i.e. sampling from some vectorized distribution and then transforming to and from.
The original thought was that this would be one of the cythonized files, i.e. allow the hyperparameter files to be seen in editors and see their definitions and workings, however this also ended up with lifting all behavior to the base Hyperparameter class. This helps for a few reasons, namely:
- A single source for behaviour of hyperparameters, reducing duplication/inconsistencies.
- Implementing hyperparameters is mostly just passing the different components described above to the base
Hyperparameter
class at this point. You can see this from the individual hyperparameter classes that exist. - Any optimizations done for the underlying shared components can apply to all hyperparmaters, for example neighbor generation or sampling.
It's not perfect of course but really it's trying to make hyperparameters rely more on compositional structure rather than hierarchical behaviors.
@mfeurer I converted all the documentation pages to use I've documented most of the major modules at this point but have yet to set up the actual doc generation process. What I think would be the most useful for you to review at this point would be the pages under I mostly left the documentation the same but I've added a clearer introduction to hyperparameters Due to a no-longer-updated take on PCS format, I've now focused serialization on The rest of the docs are mostly the same. I still have left to do API documentation pass over After that I need to setup Sorry for migration away from sphinx, but I really just don't like writing in it and it's hard to explain the nuances to anyone new. |
FYI: I tested running DeepCave with ConfigSpace 0.8.0 and ran into the following problems when executing :
|
@mfeurer, I did a major push on getting the documentation updated to @sarah-segel thanks for the report back, I will look into them with the next big push. Do you have any more information on the first one other than "ran into an error"? Second one is likely a bug on my behalf, will investigate. Last one is good to know about. It was a private method so I considered safe enough to remove. I will add it back in with the deprecation warning. |
@sarah-segel should have been fixed now, can you try again? |
This PR attempts to first convert everything to Python, so a type checker can be run across everything as well as use linters properly. This also includes updating everything to pytest.
Note: This PR is unreviewable. The strategy has been to minimally change tests while refactoring to ensure tested behaviour still passes. Some notable exceptions are where functionality was removed or sampling strategy was changed and the expected values differ. Unfortunatly the formatter has rendered them also unreviewable.
Update: All SMAC unittests passed without code changes so it seems mostly backwards compatible.
Some notable changes:
Category([True, False, "None"])
(Now handled in follow up feat(Hyperparameters): Allow arbitrary objects in category ordinal #359)TODO:
Configuration(space, vector, validate=False)
to deal with Problems integrating with BOHB #75HyperparameterNotFoundError
prohibits.get
from functioning as expected #348self.get_order
inget_neighbors
#344None
inCategoricalHyperparameter
s #166number
argument inget_neighbors
#288is_legal
can be made more explicit #237check_default
toConstant
for uniformity with other hyperparameters #270value
ofUniformFloatHyperparameter
should be in [0, 1] #290ufhp
ofUniformIntegerHyperparameter
public likeNormalIntegerHyperparameter
#291get_neighbours
can generate n samples and then validate them #236get_neighbors
#239get_neighbours
andto_uniform
#200CategoricalHyperparameter
#133