-
-
Notifications
You must be signed in to change notification settings - Fork 230
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
MAINT refactor imputation of inactive hyperparameters into function #176
Conversation
smac/configspace/__init__.py
Outdated
from ConfigSpace.util import get_random_neighbor, get_one_exchange_neighbourhood | ||
from smac.configspace.util import impute_inactive_hyperparameters |
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 haven't found such a file. maybe still missing?
btw: have you checked that the random forest can handle -1 for categorical parameters? |
@sfalkner could you please comment on the question from Marius? It boils down to: does the random forest code from commit 21157707735bc8a11ebf3790a8f5d8de2fcab860 (basically version 0.2 from last April) support -1 as a value for categorical and numerical values? |
No it doesn't. What would be the purpose of that value anyway? |
An outlier value representing a missing value. I'll update this to impute the default, but still be fast. |
You could use 0 for undefined and use 1...num_categories for the actual values...Don't know if that helps, though. But I guess you wanted the same value for numerical and categorical variables. |
Now it's the default again (as it was before). When can decide when the deadlines are over. |
c635b6f
to
2a336af
Compare
1 similar comment
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.
only small notation issues...
smac/runhistory/runhistory2epm.py
Outdated
@@ -296,12 +296,12 @@ def _build_matrix(self, run_dict, runhistory, instances=None, par_factor=1): | |||
for row, (key, run) in enumerate(run_dict.items()): | |||
# Scaling is automatically done in configSpace | |||
conf = runhistory.ids_config[key.config_id] | |||
conf = impute_inactive_values(conf) | |||
conf_array = impute_inactive_hyperparameters([conf])[0] |
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 an vector and not an array, right?
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.
Which is the same class in numpy, but I get your point. Will change this.
smac/configspace/util.py
Outdated
from smac.configspace import Configuration | ||
|
||
|
||
def impute_inactive_hyperparameters(configs: List[Configuration]) -> np.ndarray: |
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.
please add docstring
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 name of the method is a bit misleading, since it does more than imputation; it also converts it into our internal numpy representation.
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.
Docstring is there, how about convert_configurations_to_array
?
1 similar comment
Thanks! |
Refactor imputation into it's own function @mlindauer