Skip to content

Commit

Permalink
Merge branch 'main' into bug/pre-commit-hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
KrissiHub authored Nov 23, 2023
2 parents 22cf5c9 + daf6c2f commit a78ea11
Show file tree
Hide file tree
Showing 50 changed files with 6,751 additions and 22,905 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# Version 1.1.3

## Bug-Fixes
- Fix seaborn style name (#82).
- Remove potential sources of nondeterminism in evaluators by not setting seeds randomly (#75).
- Exchange SMAC log examples to fix issue with PDP (#54).
- Fix error when requesting more than 10 colors in a plot (36 colors available now).

# Version 1.1.2

## Bug-Fixes
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# are usually completed in github actions.

SHELL := /bin/bash
VERSION := 1.1.2
VERSION := 1.1.3

NAME := DeepCAVE
PACKAGE_NAME := deepcave
Expand Down
2 changes: 1 addition & 1 deletion deepcave/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"Source Code": "https://github.com/automl/deepcave",
}
copyright = f"Copyright {datetime.date.today().strftime('%Y')}, {author}"
version = "1.1.2"
version = "1.1.3"

_exec_file = sys.argv[0]
_exec_files = ["server.py", "worker.py", "sphinx-build"]
Expand Down
2 changes: 1 addition & 1 deletion deepcave/evaluators/epm/fanova_forest.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def __init__(
instance_features: Optional[np.ndarray] = None,
pca_components: Optional[int] = 2,
cutoffs: Tuple[float, float] = (-np.inf, np.inf),
seed: Optional[int] = None,
seed: int = 0,
):
super().__init__(
configspace=configspace,
Expand Down
4 changes: 1 addition & 3 deletions deepcave/evaluators/epm/random_forest.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def __init__(
instance_features: Optional[np.ndarray] = None,
pca_components: Optional[int] = 2,
log_y: bool = False,
seed: Optional[int] = None,
seed: int = 0,
):
self.cs = configspace
self.log_y = log_y
Expand Down Expand Up @@ -350,8 +350,6 @@ def _train(self, X: np.ndarray, Y: np.ndarray) -> None:
# Now we can start to prepare the data for the pyrfr
data = self._get_data_container(X, Y.flatten())
seed = self.seed
if seed is None:
seed = int(random() * 9999)

rng = regression.default_random_engine(seed)

Expand Down
6 changes: 3 additions & 3 deletions deepcave/evaluators/fanova.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def calculate(
objectives: Optional[Union[Objective, List[Objective]]] = None,
budget: Optional[Union[int, float]] = None,
n_trees: int = 16,
seed: Optional[int] = None,
seed: int = 0,
) -> None:
"""
Get the data wrt budget and train the forest on the encoded data.
Expand All @@ -73,8 +73,8 @@ def calculate(
Considered budget. By default None. If None, the highest budget is chosen.
n_trees : int, optional
How many trees should be used. By default 16.
seed : Optional[int], optional
Random seed. By default None.
seed : int
Random seed. By default 0.
"""
if objectives is None:
objectives = self.run.get_objectives()
Expand Down
5 changes: 1 addition & 4 deletions deepcave/evaluators/lpi.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def calculate(
budget: Optional[Union[int, float]] = None,
continous_neighbors: int = 500,
n_trees: int = 10,
seed: Optional[int] = None,
seed: int = 0,
) -> None:
"""
Prepare the data and train a RandomForest model.
Expand Down Expand Up @@ -101,9 +101,6 @@ def calculate(
self.default = self.cs.get_default_configuration()
self.incumbent_array = self.incumbent.get_array()

# Set the seed
if seed is None:
seed = int(random() * 9999)
self.seed = seed
self.rs = np.random.RandomState(seed)

Expand Down
1 change: 1 addition & 0 deletions deepcave/utils/styled_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class StyledPlot:
The style used is seaborn.
"""


def __init__(self) -> None:
plt.style.use("seaborn-v0_8")

Expand Down
5 changes: 4 additions & 1 deletion deepcave/utils/styled_plotty.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,10 @@ def get_color(id_: int, alpha: float = 1) -> Union[str, Tuple[float, float, floa
Union[str, Tuple[float, float, float, float]]
The color from the color palette.
"""
color = px.colors.qualitative.Plotly[id_]
if id_ < 10:
color = px.colors.qualitative.Plotly[id_]
else:
color = px.colors.qualitative.Alphabet[id_ - 10]

r, g, b = hex_to_rgb(color)
return f"rgba({r}, {g}, {b}, {alpha})"
Expand Down
100 changes: 19 additions & 81 deletions logs/SMAC3v1/mlp/run_1/configspace.json
Original file line number Diff line number Diff line change
@@ -1,102 +1,40 @@
{
"hyperparameters": [
{
"name": "activation",
"type": "categorical",
"choices": [
"logistic",
"tanh",
"relu"
],
"default": "tanh",
"probabilities": null
},
{
"name": "n_layer",
"type": "uniform_int",
"log": false,
"lower": 1,
"upper": 5,
"default": 1,
"q": null
"name": "alpha",
"type": "uniform_float",
"log": true,
"lower": 1e-08,
"upper": 1.0,
"default": 0.001
},
{
"name": "n_neurons",
"name": "batch_size",
"type": "uniform_int",
"log": true,
"lower": 8,
"upper": 1024,
"default": 10,
"q": null
},
{
"name": "solver",
"type": "categorical",
"choices": [
"lbfgs",
"sgd",
"adam"
],
"default": "adam",
"probabilities": null
"lower": 4,
"upper": 256,
"default": 32
},
{
"name": "batch_size",
"name": "depth",
"type": "uniform_int",
"log": false,
"lower": 30,
"upper": 300,
"default": 200,
"q": null
},
{
"name": "learning_rate",
"type": "categorical",
"choices": [
"constant",
"invscaling",
"adaptive"
],
"default": "constant",
"probabilities": null
"lower": 1,
"upper": 3,
"default": 3
},
{
"name": "learning_rate_init",
"type": "uniform_float",
"log": true,
"lower": 0.0001,
"lower": 1e-05,
"upper": 1.0,
"default": 0.001,
"q": null
}
],
"conditions": [
{
"child": "batch_size",
"parent": "solver",
"type": "IN",
"values": [
"sgd",
"adam"
]
},
{
"child": "learning_rate",
"parent": "solver",
"type": "EQ",
"value": "sgd"
},
{
"child": "learning_rate_init",
"parent": "solver",
"type": "IN",
"values": [
"sgd",
"adam"
]
"default": 0.001
}
],
"conditions": [],
"forbiddens": [],
"python_module_version": "0.4.19",
"json_format_version": 0.2
"python_module_version": "0.6.1",
"json_format_version": 0.4
}
4 changes: 4 additions & 0 deletions logs/SMAC3v1/mlp/run_1/configspace.pcs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
alpha real [1e-08, 1.0] [0.001]log
batch_size integer [4, 256] [32]log
depth integer [1, 3] [3]
learning_rate_init real [1e-05, 1.0] [0.001]log
Loading

0 comments on commit a78ea11

Please sign in to comment.