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

fix pyrfr int cast seed #1083

Closed
wants to merge 577 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
577 commits
Select commit Hold shift + click to select a range
9b5e3b0
Prettification
renesass Jun 30, 2022
d4bab75
Add result merger
benjamc Jun 30, 2022
08762e1
Reformat with black
benjamc Jun 30, 2022
a6edcb9
Delete unnecessary import
benjamc Jun 30, 2022
5175c81
Fix typing
benjamc Jun 30, 2022
227592d
Inject first trajectory entry from file from first rundir
benjamc Jun 30, 2022
1a6d21a
Add test for ResultMerger
benjamc Jun 30, 2022
f47dc89
Fix docstring
benjamc Jun 30, 2022
b13f29c
Get runhistory and trajectory from pSMAC run
benjamc Jun 30, 2022
725c038
Get trajectory
benjamc Jun 30, 2022
d88a5c7
Add regex to requirements
benjamc Jun 30, 2022
8593d0b
Fixed MO cache problem
renesass Jul 4, 2022
1fc402a
Fix MO tests
renesass Jul 5, 2022
7127a65
Fixing MO in AbstractRacer
renesass Jul 5, 2022
85e692a
Accepting ints
renesass Jul 5, 2022
2176b99
Hacking in the sum cost for MO
renesass Jul 5, 2022
2d6a9ce
Fix mypi
renesass Jul 5, 2022
9f23798
Bugfix
renesass Jul 5, 2022
cc6dc30
Make mypi happy
renesass Jul 5, 2022
0746e9b
Fix tests
renesass Jul 5, 2022
47906ef
Make format
renesass Jul 5, 2022
ad0ebf4
Remove num_obj in MO optimizer
renesass Jul 6, 2022
05f1cf6
A lot of restructuring
renesass Jul 6, 2022
3f6d3af
Solve importings
renesass Jul 6, 2022
19619bb
Solve importings
renesass Jul 6, 2022
79c8393
Fixing, fixing, fixing, ...
renesass Jul 6, 2022
b266bb8
Fixing, fixing, fixing, ...
renesass Jul 6, 2022
464406f
Fixing, fixing, fixing, ...
renesass Jul 6, 2022
d361957
Fixing, fixing, fixing, ...
renesass Jul 6, 2022
ac86d42
Fixing, fixing, fixing, ...
renesass Jul 6, 2022
5802258
Fixing, fixing, fixing, ...
renesass Jul 6, 2022
047d6a4
Fixing, fixing, fixing, ...
renesass Jul 6, 2022
6091d6c
Fixing, fixing, fixing, ...
renesass Jul 6, 2022
616bb6d
Fixing, fixing, fixing, ...
renesass Jul 6, 2022
b6d27f9
Updated changelog
renesass Jul 6, 2022
64a8532
Still fixing :)
renesass Jul 6, 2022
4afe8ba
fix docstrings
dengdifan Jul 6, 2022
c250166
Change directory of tests
benjamc Jul 7, 2022
acae71c
Fix ambiguous variable
benjamc Jul 7, 2022
92551bb
Del newlines
benjamc Jul 7, 2022
b028bd2
fix mypy
dengdifan Jul 7, 2022
1d47600
mypy and doc fix
dengdifan Jul 7, 2022
a34dd46
Removed int type checking
renesass Jul 7, 2022
efdd5c5
fix tests
dengdifan Jul 7, 2022
db4e020
Always return List of incs
benjamc Jul 7, 2022
165c844
fix path issue in example
dengdifan Jul 7, 2022
dc24106
maint boing facade
dengdifan Jul 7, 2022
04afc03
Better docstring
renesass Jul 7, 2022
06a4fca
Return values if no bounds passed
renesass Jul 7, 2022
4e3caed
Removed import
renesass Jul 7, 2022
100e2f3
Merge pull request #872 from automl/fix_mo_cache
renesass Jul 7, 2022
6b60582
Prepare BOinG (#730)
renesass Jul 7, 2022
563d36f
Return only one incumbent
benjamc Jul 7, 2022
ea8796b
Rename n_optimizers -> n_workers
benjamc Jul 7, 2022
a539e44
Update example
benjamc Jul 7, 2022
e576165
Update docstring
benjamc Jul 7, 2022
485f299
Remove legacy function
benjamc Jul 7, 2022
2e56e1c
Update to new signature
benjamc Jul 7, 2022
cc53b39
Update changelog.md
benjamc Jul 7, 2022
6b680bd
Format black
benjamc Jul 7, 2022
2623236
Update test
Jul 7, 2022
57ef2d9
Please pre-commit
Jul 7, 2022
9bf5ebd
Merge development
renesass Jul 7, 2022
6ab9ced
Merge pSMAC update (#821)
renesass Jul 7, 2022
59e271f
Fix tests
renesass Jul 7, 2022
7b91fde
Fix typos
benjamc Jul 11, 2022
91198d7
Format black
benjamc Jul 11, 2022
d9c608e
Updated text
renesass Jul 14, 2022
e83abee
Increased version
renesass Jul 14, 2022
64c5cbf
Merge branch 'main' into development
renesass Jul 14, 2022
033a5b1
Merge branch 'main' into development
renesass Oct 12, 2022
4a50949
Improved readme
renesass Oct 12, 2022
1729c65
SMAC logo 50%
renesass Oct 12, 2022
dc4124a
SMAC logo 50%
renesass Oct 12, 2022
65cfa97
Removed dev-2.0
renesass Oct 12, 2022
ef296ed
Added doc workflow for latest tag
renesass Oct 18, 2022
47fffc9
Fixing docs latest tag
renesass Oct 18, 2022
45d7465
Fixing docs latest tag
renesass Oct 18, 2022
813acf4
First steps new intensifier
renesass Oct 18, 2022
a659b13
Make it work again
renesass Oct 18, 2022
fd42b24
MOVE random weight initialization to smbo ask method
KEggensperger Oct 18, 2022
f6a540f
ADD enable parego in unittests
KEggensperger Oct 18, 2022
b53abc8
Test issues
renesass Oct 19, 2022
bc0019f
FIX formatting
KEggensperger Oct 19, 2022
330982d
Link to old documentation
renesass Oct 19, 2022
5ae6a7d
MOVE random weight initialization to smbo ask method
KEggensperger Oct 18, 2022
9222316
ADD enable parego in unittests
KEggensperger Oct 18, 2022
c4241a8
FIX formatting
KEggensperger Oct 19, 2022
aa82ac0
Fix unit tests
mfeurer Oct 25, 2022
74ce8a7
Add annotation
mfeurer Oct 25, 2022
7ed2369
corrected log prob for tophat prior
Oct 25, 2022
10968cd
Fixed mypy
renesass Oct 26, 2022
329360d
Removed configurations from callback
renesass Oct 26, 2022
dcd52a7
Fixed tests
renesass Oct 26, 2022
df7fe7b
Fix mypy
renesass Oct 26, 2022
11e86b3
Merge pull request #885 from automl/FIX_parego
renesass Oct 26, 2022
e4ec3c7
Merge pull request #887 from ekalosak/main
renesass Oct 26, 2022
ffefc4d
Save docs as latest version too
renesass Oct 26, 2022
9f0b3b4
Enabled all tests again
renesass Oct 26, 2022
bb7bef6
Make version an env
renesass Oct 26, 2022
614e508
Added last version to docs
renesass Oct 26, 2022
91ddf6b
Global variable fix
renesass Oct 26, 2022
5e43344
Added v before version number
renesass Oct 26, 2022
cec24d2
Merge branch 'main' into development
renesass Oct 26, 2022
d99074c
New Intensifier Implementation (#888)
renesass Dec 7, 2022
89a15b5
First benchmark steps
renesass Dec 7, 2022
10c7b4e
Added a warning
renesass Dec 7, 2022
3a66258
Set xi to 0.01
renesass Dec 12, 2022
6adeaa5
Incorporated walltime in trajectory
renesass Dec 12, 2022
760f67f
Working version of benchmark
renesass Dec 14, 2022
05be313
Changed requirements
renesass Dec 14, 2022
7005d4a
Changed xi back to 0.0 again
renesass Dec 15, 2022
b4c8124
No duplicate budgets
renesass Dec 15, 2022
a6f3837
Fixed bug which updated tracker wrongly
renesass Dec 15, 2022
35492d2
Bugfix: Delete correct bracket+stage
renesass Dec 19, 2022
cb63905
Fixed tests
renesass Dec 19, 2022
4ca0dcd
Added costs to the trajectory
renesass Dec 20, 2022
e2926da
Changed initial design max ratio to 0.25
renesass Dec 20, 2022
4cbf0a9
Make format
renesass Dec 20, 2022
22c5e73
Added more details to intensifier
renesass Dec 20, 2022
9c3efaf
Finished benchmark
renesass Dec 20, 2022
5c0dd76
Added benchmark source files
renesass Dec 20, 2022
4f5f6ef
Fixed tests because of initial design changes
renesass Dec 20, 2022
1a4d084
Improved runhistory API
renesass Dec 20, 2022
c66b8a6
Fixed typo (#894)
PascalIversen Dec 20, 2022
ef783e3
Merge doc fixes
renesass Dec 20, 2022
660b10d
Doc fixes (#893)
helegraf Dec 20, 2022
fddd98f
Make format
renesass Dec 20, 2022
15d9717
Satisfied mypy
renesass Dec 20, 2022
4413f6d
Enabled more tests
renesass Dec 20, 2022
92f025f
Increased version
renesass Dec 20, 2022
4dd5541
Mypy
renesass Dec 21, 2022
7fa26bb
Mypy
renesass Dec 21, 2022
b951d77
Mypy
renesass Dec 21, 2022
efcdabc
Fixed critical bug when using highest budget for inc selection
renesass Dec 21, 2022
b99c15c
Added SH+HB comparison
renesass Dec 21, 2022
3d869d1
Stuff
renesass Dec 22, 2022
b7aa793
Updated report
renesass Dec 22, 2022
b358d28
Fixed docstring
renesass Dec 22, 2022
8cd59c0
Fixed image path
renesass Dec 22, 2022
d681dd1
Removed vscode folder
renesass Dec 22, 2022
8c582b0
Bugfixes
renesass Dec 30, 2022
09f2d13
Doc fixes
renesass Dec 30, 2022
35e4f2d
Updated changelog
renesass Dec 30, 2022
0324b0e
Make isort
renesass Dec 30, 2022
58f0ea2
Fix typos
Jan 2, 2023
044beac
Removed new line
renesass Jan 7, 2023
69820e9
Added alpha2 to docs selection
renesass Jan 7, 2023
851e321
update description
dengdifan Jan 10, 2023
134c36f
Fix 531 correctly create integers in initial design
mfeurer Jan 11, 2023
8c2f1b2
Add contact paragraph to README.
alexandertornede Jan 19, 2023
469ca05
Increase days until stale issues are closed by stalebot (#904)
helegraf Jan 19, 2023
78488e7
Edit changelog
Jan 25, 2023
cd4ec30
Merge pull request #899 from automl/description
alexandertornede Jan 27, 2023
292e53d
Add issue number
Jan 27, 2023
9b98770
Merge pull request #900 from automl/fix_531
sarah-segel Jan 27, 2023
fc07e9b
Closes #907
renesass Jan 30, 2023
c247853
Clarify origin of configurations (#908)
helegraf Jan 30, 2023
2927921
Random forest speed up (#903)
jeroenrook Jan 30, 2023
a0a8fd1
Add: workflow to update pre-commit versions (#874)
eddiebergman Jan 30, 2023
4eb6528
Add Git-Flow Workflow Specification
helegraf Feb 2, 2023
da841e2
[DOC] acquisition function maximizers
Feb 2, 2023
f7209de
Add stale reminder email action
helegraf Feb 13, 2023
ef4653d
Merge pull request #919 from automl/hotfix/early_emails_stale_issues
helegraf Feb 13, 2023
871d656
Increase version number of ConfigSpace
benjamc Feb 16, 2023
e6c77a8
Merge branch 'feature/improve_documentation' into development
Feb 16, 2023
9207944
Add guideline for updating copyright notice years to CONTRIBUTING.md
helegraf Feb 16, 2023
cf6ee29
Merge pull request #911 from automl/feature/specify_git-flow_workflows
timruhkopf Feb 16, 2023
e5f9875
Update requirement for pyrfr (#920)
dengdifan Feb 16, 2023
83b3dc4
Update pre-commit: isort,flake8 version numbers
Feb 23, 2023
a6c60c8
Merge branch 'development' of https://github.com/automl/SMAC3 into de…
Feb 23, 2023
14ddf7a
Format black
Feb 23, 2023
c861ae4
Fix mypy
Feb 23, 2023
0bdb6fa
Ac bench (#929)
benjamc Mar 2, 2023
1addb24
[DOC] added documentation on the incumbent update
Mar 2, 2023
8564d5d
Feature/add version to make publish (#931)
sarah-segel Mar 2, 2023
981f32a
Transform integer feature names to strings (#930)
renesass Mar 2, 2023
302b8b3
Merge remote-tracking branch 'origin/development' into development
Mar 2, 2023
4dce9b6
Update version to 2.0.0
benjamc Mar 2, 2023
8407f21
Update version to 2.0.0
Mar 2, 2023
b91734f
Update CHANGELOG.md
benjamc Mar 2, 2023
9f3ba23
Add information on deepcave to the readme
Mar 2, 2023
cc94031
Merge branch 'main' into development
helegraf Mar 3, 2023
df0fd5c
Correct doc version
Mar 3, 2023
58a7d12
fix(runhistory): set id of the sampled config (#951)
aron-bram Mar 23, 2023
2b0419a
ci: Set dependabot to target development branch (#963)
eddiebergman Apr 11, 2023
719dcdd
Resolve merge conflict
Apr 11, 2023
5fb2000
feat: Option preventing SMAC setting up logging (#947)
eddiebergman Apr 11, 2023
628cb9d
Citation update (#961)
dengdifan Apr 12, 2023
6cf3f04
Adjust hyperband configuration distribution across brackets
helegraf Apr 15, 2023
c308062
Compute the actual differences between the isb keys. (#957)
jeroenrook Apr 17, 2023
af1f7c5
Adjust schedule for stale reminder
helegraf Apr 17, 2023
d0461c8
fix(logging): Prevent automatic logging setup at init (#970)
eddiebergman Apr 17, 2023
6cd50b7
Merge pull request #974 from automl/hotfix/adjust_stale_reminder_sche…
helegraf Apr 17, 2023
56b031c
Fix validate method of smbo, update docstring.
helegraf Apr 19, 2023
cc8a817
Merge pull request #981 from automl/fix/smbo_validate
helegraf Apr 19, 2023
970fe94
Merge branch 'development' into fix/hyperband_bracket_scaling
helegraf Apr 21, 2023
7965296
Allow callbacks to be added to a specific index, make callback regist…
helegraf Apr 25, 2023
2c58693
Update CHANGELOG.md
helegraf Apr 25, 2023
35197c2
Merge pull request #989 from automl/fix/callback_order
helegraf Apr 25, 2023
93b67d5
Merge pull request #980 from automl/fix/hyperband_bracket_scaling
helegraf Apr 25, 2023
3810c1c
Merge pull request #991 from automl/hotfix/update_stale_labels
helegraf Apr 25, 2023
36e97f2
Fix broken references (#988)
dengdifan May 4, 2023
093e749
Adapt developer install instructions to include pre-commit installati…
sarah-segel May 4, 2023
9875de0
[Feature] Initial Design now supports executing the default config pr…
May 4, 2023
488402a
Merge branch 'development' into feature/initial_design_defaults
timruhkopf May 4, 2023
d68d18f
Pipe dask_client through facade for exec on hpc (#983)
benjamc May 4, 2023
e11ade6
[Bug-fix] Pr was failing due to mutable additional configs default
May 4, 2023
0bdedd1
Merge remote-tracking branch 'origin/feature/initial_design_defaults'…
May 4, 2023
0ec392e
[doc-fix] the count of initial design configs is computed slightly di…
May 4, 2023
6687e4b
Feature/metadata callback (#999)
sarah-segel May 16, 2023
aacbcc2
Merge branch 'development' into feature/initial_design_defaults
timruhkopf May 16, 2023
89c2ba3
Merge pull request #995 from automl/feature/initial_design_defaults
timruhkopf May 16, 2023
486ea1a
Documentation/dask client example (#1001)
benjamc May 16, 2023
0d9b91e
Documentation/dask client example (#1001)
benjamc May 16, 2023
eacaa57
Feature/dask client (#1002)
benjamc May 16, 2023
dcf77ad
Update smac version (#1003)
sarah-segel May 16, 2023
486b3a9
Update copyright year
May 16, 2023
b5c16a1
check if config in rh when storing state (#997)
dengdifan May 16, 2023
162a5dd
Merge branch 'development' of github.com:automl/SMAC3 into development
May 16, 2023
ef3885b
Add a workaround to be able to pass a dataset via dask.scatter (#993)
nabenabe0928 May 16, 2023
03e1ca8
Adding Binder links for example (#976)
dengdifan May 16, 2023
6d68ac6
Remove commit message from dependabot PRs (#1009)
eddiebergman May 17, 2023
921883e
Solve merge conflict
May 17, 2023
d31c1d3
Bugfix/fix broken link (#1012)
sarah-segel May 22, 2023
3d1f249
Merge branch 'main' of github.com:automl/SMAC3 into development
May 22, 2023
df6659f
Merge branch 'main' of github.com:automl/SMAC3 into development
May 22, 2023
af60825
Drop torch requirements (#1015)
benjamc May 23, 2023
cc14039
Remove leftover CLI entry points (#1014)
BastianZim May 23, 2023
ab5f88f
Fix incumbent selection in case of SH+MO
helegraf Jun 1, 2023
12aa9b0
Update CHANGELOG.md
helegraf Jun 1, 2023
4e5b4d1
Merge pull request #1022 from automl/fix/sh_get_best_configs
helegraf Jun 1, 2023
7cbd360
Feature/GitHub actions pr draft (#1008)
timruhkopf Jun 1, 2023
da58c9c
Update stale report to include issues with recent interactions (#1025)
helegraf Jun 2, 2023
cb1cd2f
Raise error if resource limitation and parallelization is requested (…
benjamc Jun 6, 2023
787f5d6
Raise an error for invalid scatter data (#1018)
nabenabe0928 Jun 6, 2023
b1695f0
fix(configspace): shows all keys in print (#1043)
eddiebergman Jun 23, 2023
345d9f1
Fix callback order (#1040)
benjamc Jun 26, 2023
8b64d1e
fix: dtypes (#1044)
eddiebergman Jun 26, 2023
81d2f77
Fix(config_selector): Budget checking (#1039)
eddiebergman Jun 26, 2023
5aa921a
Fix: target runner with partial func (#1045)
eddiebergman Jun 26, 2023
83eaab5
Feature/improve documentation (#1028)
sarah-segel Jun 27, 2023
cbffa5f
Handle configspace as dictionary in mlp example (#1057)
sarah-segel Jul 20, 2023
bf02a23
Raise version number
Jul 31, 2023
0650ad5
Add missing period in docs.
Jul 31, 2023
064e133
Merge branch 'main' of github.com:automl/SMAC3 into development
Aug 1, 2023
a15c1b7
allow rf to impute OrdinalHyperparameter (#1065)
dengdifan Oct 5, 2023
d58d5b1
fix dask_scheduler_file path (#1055)
markwwen Oct 5, 2023
06d584f
Fix config rejection for #1068 (#1069)
PhilippBordne Oct 9, 2023
2591549
fix(RandomForest): Always cast `seed` to `int`
eddiebergman Nov 16, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# 2.0.3

## Bugfixes
- Fix path for dask scheduler file (#1055).
- Add OrdinalHyperparameter for random forest imputer (#1065).
- Configurations that fail to become incumbents will be added to the rejected lists (#1069).

# 2.0.2

## Improvements
Expand Down
8 changes: 6 additions & 2 deletions smac/intensifier/abstract_intensifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -571,8 +571,12 @@ def update_incumbents(self, config: Configuration) -> None:

if len(previous_incumbents) == len(new_incumbents):
if previous_incumbents == new_incumbents:
# No changes in the incumbents
self._remove_rejected_config(config_id)
# No changes in the incumbents, we need this clause because we can't use set difference then
if config_id in new_incumbent_ids:
self._remove_rejected_config(config_id)
else:
# config worse than incumbents and thus rejected
self._add_rejected_config(config_id)
return
else:
# In this case, we have to determine which config replaced which incumbent and reject it
Expand Down
5 changes: 4 additions & 1 deletion smac/model/random_forest/abstract_random_forest.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from ConfigSpace import (
CategoricalHyperparameter,
Constant,
OrdinalHyperparameter,
UniformFloatHyperparameter,
UniformIntegerHyperparameter,
)
Expand Down Expand Up @@ -36,12 +37,14 @@ def _impute_inactive(self, X: np.ndarray) -> np.ndarray:
self._conditional[idx] = True
if isinstance(hp, CategoricalHyperparameter):
self._impute_values[idx] = len(hp.choices)
elif isinstance(hp, OrdinalHyperparameter):
self._impute_values[idx] = len(hp.sequence)
elif isinstance(hp, (UniformFloatHyperparameter, UniformIntegerHyperparameter)):
self._impute_values[idx] = -1
elif isinstance(hp, Constant):
self._impute_values[idx] = 1
else:
raise ValueError
raise ValueError(f"Unsupported hyperparameter type: {type(hp)}")

if self._conditional[idx] is True:
nonfinite_mask = ~np.isfinite(X[:, idx])
Expand Down
4 changes: 3 additions & 1 deletion smac/model/random_forest/random_forest.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ def __init__(
self._rf_opts.compute_law_of_total_variance = False
self._rf: BinaryForest | None = None
self._log_y = log_y
self._rng = regression.default_random_engine(seed)

# Case to `int` incase we get an `np.integer` type
self._rng = regression.default_random_engine(int(seed))

self._n_trees = n_trees
self._n_points_per_tree = n_points_per_tree
Expand Down
2 changes: 1 addition & 1 deletion smac/runner/dask_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def __init__(
)

if self._scenario.output_directory is not None:
self._scheduler_file = self._scenario.output_directory / ".dask_scheduler_file"
self._scheduler_file = Path(self._scenario.output_directory, ".dask_scheduler_file")
self._client.write_scheduler_file(scheduler_file=str(self._scheduler_file))
else:
# We just use their set up
Expand Down
42 changes: 42 additions & 0 deletions tests/test_intensifier/test_abstract_intensifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,48 @@ def test_incumbent_selection_multi_objective(make_scenario, configspace_small, m
assert intensifier.get_incumbents() == [config]


def test_config_rejection_single_objective(configspace_small, make_scenario):
""" Tests whether configs are rejected properly if they are worse than the incumbent. """
scenario = make_scenario(configspace_small, use_instances=False)
runhistory = RunHistory()
intensifier = Intensifier(scenario=scenario)
intensifier.runhistory = runhistory

configs = configspace_small.sample_configuration(3)

runhistory.add(config=configs[0],
cost=5,
time=0.0,
seed=0,
status=StatusType.SUCCESS,
force_update=True)
intensifier.update_incumbents(configs[0])

assert intensifier._rejected_config_ids == []

# add config that yielded better results, updating incumbent and sending prior incumbent to rejected
runhistory.add(config=configs[1],
cost=1,
time=0.0,
seed=0,
status=StatusType.SUCCESS,
force_update=True)
intensifier.update_incumbents(config=configs[1])

assert intensifier._rejected_config_ids == [1]

# add config that is no better should thus go to rejected
runhistory.add(config=configs[2],
cost=1,
time=0.0,
seed=0,
status=StatusType.SUCCESS,
force_update=True)
intensifier.update_incumbents(config=configs[2])

assert intensifier._rejected_config_ids == [1, 3]


def test_incumbent_differences(make_scenario, configspace_small):
pass

Expand Down
14 changes: 13 additions & 1 deletion tests/test_model/test_rf.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,24 +257,36 @@ def test_with_ordinal():

def test_impute_inactive_hyperparameters():
cs = ConfigurationSpace(seed=0)
a = cs.add_hyperparameter(CategoricalHyperparameter("a", [0, 1]))
a = cs.add_hyperparameter(CategoricalHyperparameter("a", [0, 1, 2]))
b = cs.add_hyperparameter(CategoricalHyperparameter("b", [0, 1]))
c = cs.add_hyperparameter(UniformFloatHyperparameter("c", 0, 1))
d = cs.add_hyperparameter(OrdinalHyperparameter("d", [0, 1, 2]))
cs.add_condition(EqualsCondition(b, a, 1))
cs.add_condition(EqualsCondition(c, a, 0))
cs.add_condition(EqualsCondition(d, a, 2))

configs = cs.sample_configuration(size=100)
config_array = convert_configurations_to_array(configs)
for line in config_array:
if line[0] == 0:
assert np.isnan(line[1])
assert np.isnan(line[3])
elif line[0] == 1:
assert np.isnan(line[2])
assert np.isnan(line[3])
elif line[0] == 2:
assert np.isnan(line[1])
assert np.isnan(line[2])

model = RandomForest(configspace=cs)
config_array = model._impute_inactive(config_array)
for line in config_array:
if line[0] == 0:
assert line[1] == 2
assert line[3] == 3
elif line[0] == 1:
assert line[2] == -1
assert line[3] == 3
elif line[0] == 2:
assert line[1] == 2
assert line[2] == -1
Loading