-
-
Notifications
You must be signed in to change notification settings - Fork 230
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
290 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
doc-warnings: true | ||
test-warnings: false | ||
strictness: veryhigh | ||
max-line-length: 100 | ||
pep8: | ||
full: true | ||
ignore-paths: | ||
- ci_scripts | ||
ignore-patterns: | ||
- (^|/)docs(/|$) | ||
python-targets: | ||
- 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ six | |
Cython | ||
psutil | ||
pynisher>=0.4.1 | ||
ConfigSpace>=0.2.1 | ||
ConfigSpace>=0.3.0 | ||
pyrfr | ||
scikit-learn | ||
typing |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
"""Version information.""" | ||
|
||
# The following line *must* be the last in the module, exactly as formatted: | ||
__version__ = "0.2.3" | ||
__version__ = "0.3.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
from ConfigSpace import ConfigurationSpace, Configuration | ||
from ConfigSpace.io import pcs | ||
from ConfigSpace.util import impute_inactive_values, get_random_neighbor, get_one_exchange_neighbourhood | ||
from ConfigSpace.util import get_random_neighbor, get_one_exchange_neighbourhood | ||
from smac.configspace.util import convert_configurations_to_array |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
from typing import List | ||
|
||
import numpy as np | ||
|
||
from smac.configspace import Configuration | ||
|
||
|
||
def convert_configurations_to_array(configs: List[Configuration]) -> np.ndarray: | ||
"""Impute inactive hyperparameters in configurations with their default. | ||
Necessary to apply an EPM to the data. | ||
Parameters | ||
---------- | ||
configs : List[Configuration] | ||
List of configuration objects. | ||
Returns | ||
np.ndarray | ||
Array with configuration hyperparameters. Inactive values are imputed | ||
with their default value. | ||
""" | ||
configs_array = np.array([config.get_array() for config in configs], | ||
dtype=np.float64) | ||
configuration_space = configs[0].configuration_space | ||
for hp in configuration_space.get_hyperparameters(): | ||
default = hp._inverse_transform(hp.default) | ||
idx = configuration_space.get_idx_by_hyperparameter_name(hp.name) | ||
|
||
# Create a mask which is True for all non-finite entries in column idx! | ||
column_mask = np.zeros(configs_array.shape, dtype=np.bool) | ||
column_mask[:, idx] = True | ||
nonfinite_mask = ~np.isfinite(configs_array) | ||
mask = column_mask & nonfinite_mask | ||
|
||
configs_array[mask] = default | ||
return configs_array |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.