Skip to content

Commit bdcf3e5

Browse files
0.9.8
1 parent 941ccb5 commit bdcf3e5

6 files changed

Lines changed: 43 additions & 28 deletions

File tree

notebooks/testKriging.ipynb

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2019,9 +2019,24 @@
20192019
},
20202020
{
20212021
"cell_type": "code",
2022-
"execution_count": null,
2022+
"execution_count": 1,
20232023
"metadata": {},
2024-
"outputs": [],
2024+
"outputs": [
2025+
{
2026+
"name": "stderr",
2027+
"output_type": "stream",
2028+
"text": [
2029+
"Seed set to 123\n"
2030+
]
2031+
},
2032+
{
2033+
"name": "stdout",
2034+
"output_type": "stream",
2035+
"text": [
2036+
"fun_control: {'CHECKPOINT_PATH': 'runs/saved_models/', 'DATASET_PATH': 'data/', 'RESULTS_PATH': 'results/', 'TENSORBOARD_PATH': 'runs/', '_L_in': None, '_L_out': None, 'data': None, 'data_dir': './data', 'data_module': None, 'data_set': None, 'device': None, 'enable_progress_bar': False, 'eval': None, 'fun_evals': inf, 'k_folds': 3, 'log_level': 10, 'loss_function': None, 'max_time': 1, 'metric_river': None, 'metric_sklearn': None, 'metric_torch': None, 'metric_params': {}, 'model_dict': {}, 'n_samples': None, 'num_workers': 0, 'optimizer': None, 'path': None, 'prep_model': None, 'save_model': False, 'seed': 123, 'show_batch_interval': 1000000, 'show_progress': False, 'shuffle': None, 'sigma': 0.0, 'target_column': None, 'tolerance_x': 0, 'train': None, 'test': None, 'task': 'classification', 'spot_tensorboard_path': None, 'var_name': None, 'var_type': None, 'weights': 1.0, 'spot_writer': None}\n"
2037+
]
2038+
}
2039+
],
20252040
"source": [
20262041
"import numpy as np\n",
20272042
"from spotPython.fun.objectivefunctions import analytical\n",

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ build-backend = "setuptools.build_meta"
77

88
[project]
99
name = "spotPython"
10-
version = "0.9.7"
10+
version = "0.9.8"
1111
authors = [
1212
{ name="T. Bartz-Beielstein", email="tbb@bartzundbartz.de" }
1313
]

src/spotPython/hyperparameters/values.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1022,7 +1022,7 @@ def create_model(config, fun_control, **kwargs) -> object:
10221022
return fun_control["core_model"](**config, **kwargs)
10231023

10241024

1025-
def set_fun_control_key_value(fun_control, key, value, replace=False) -> None:
1025+
def set_control_key_value(fun_control, key, value, replace=False) -> None:
10261026
"""
10271027
This function sets the key value pair in the fun_control dictionary.
10281028
@@ -1042,9 +1042,9 @@ def set_fun_control_key_value(fun_control, key, value, replace=False) -> None:
10421042
10431043
Examples:
10441044
>>> from spotPython.utils.init import fun_control_init
1045-
from spotPython.hyperparameters.values import set_fun_control_key_value
1045+
from spotPython.hyperparameters.values import set_control_key_value
10461046
fun_control = fun_control_init()
1047-
set_fun_control_key_value(fun_control=fun_control,
1047+
set_control_key_value(fun_control=fun_control,
10481048
key="key",
10491049
value="value")
10501050
fun_control["key"]
@@ -1057,7 +1057,7 @@ def set_fun_control_key_value(fun_control, key, value, replace=False) -> None:
10571057
fun_control.update({key: value})
10581058

10591059

1060-
def get_fun_control_key_value(fun_control=None, key=None) -> Any:
1060+
def get_control_key_value(fun_control=None, key=None) -> Any:
10611061
"""
10621062
This function gets the key value pair from the fun_control dictionary.
10631063
If the key does not exist, return None.
@@ -1074,9 +1074,9 @@ def get_fun_control_key_value(fun_control=None, key=None) -> Any:
10741074
10751075
Examples:
10761076
>>> from spotPython.utils.init import fun_control_init
1077-
from spotPython.hyperparameters.values import get_fun_control_key_value
1077+
from spotPython.hyperparameters.values import get_control_key_value
10781078
fun_control = fun_control_init()
1079-
get_fun_control_key_value(fun_control=fun_control,
1079+
get_control_key_value(fun_control=fun_control,
10801080
key="key")
10811081
"value"
10821082
"""

src/spotPython/spot/spot.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@
3232
from spotPython.utils.convert import find_indices
3333
from spotPython.hyperparameters.values import (
3434
get_bound_values,
35-
set_fun_control_key_value,
36-
get_fun_control_key_value,
35+
set_control_key_value,
36+
get_control_key_value,
3737
)
3838
import plotly.graph_objects as go
3939
from typing import Union, Callable, Dict
@@ -240,8 +240,8 @@ def __init__(
240240
# key "sigma" and the value sigma amd the key "seed" and the value seed.
241241
# This is a mimimum requirement for the fun_control dictionary to call
242242
# objective functions from the spotPython.fun.objectivefunctions module.
243-
set_fun_control_key_value(fun_control=self.fun_control, key="sigma", value=sigma)
244-
set_fun_control_key_value(fun_control=self.fun_control, key="seed", value=seed)
243+
set_control_key_value(fun_control=self.fun_control, key="sigma", value=sigma)
244+
set_control_key_value(fun_control=self.fun_control, key="seed", value=seed)
245245
# Random number generator:
246246
self.rng = default_rng(self.fun_control["seed"])
247247

@@ -400,8 +400,8 @@ def set_self_attribute(self, attribute, value, dict):
400400
dict (dict): the dictionary to check for the key
401401
"""
402402
setattr(self, attribute, value)
403-
if get_fun_control_key_value(fun_control=dict, key=attribute) is not None:
404-
setattr(self, attribute, get_fun_control_key_value(fun_control=dict, key=attribute))
403+
if get_control_key_value(fun_control=dict, key=attribute) is not None:
404+
setattr(self, attribute, get_control_key_value(fun_control=dict, key=attribute))
405405

406406
def get_spot_attributes_as_df(self) -> pd.DataFrame:
407407
"""Get all attributes of the spot object as a pandas dataframe.

src/spotPython/utils/init.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import os
22
import lightning as L
33
import datetime
4-
from math import inf
4+
55

66
# PyTorch TensorBoard support
77
from torch.utils.tensorboard import SummaryWriter
@@ -13,7 +13,7 @@ def fun_control_init(
1313
TENSORBOARD_CLEAN=False,
1414
device=None,
1515
enable_progress_bar=False,
16-
fun_evals=inf,
16+
fun_evals=15,
1717
log_level=10,
1818
max_time=1,
1919
num_workers=0,

test/test_values.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import numpy as np
33
from spotPython.utils.init import fun_control_init
44
from spotPython.hyperparameters.values import get_bound_values
5-
from spotPython.hyperparameters.values import get_fun_control_key_value, set_fun_control_key_value
5+
from spotPython.hyperparameters.values import get_control_key_value, set_control_key_value
66

77

88
def test_get_bound_values():
@@ -29,35 +29,35 @@ def test_get_bound_values():
2929
get_bound_values(fun_control, "invalid", as_list=True)
3030

3131

32-
def test_set_fun_control_key_value():
32+
def test_set_control_key_value():
3333
fun_control = fun_control_init()
3434

3535
# Test when key is not in fun_control and replace is False
36-
set_fun_control_key_value(fun_control, "key1", "value1")
36+
set_control_key_value(fun_control, "key1", "value1")
3737
assert fun_control["key1"] == "value1"
3838

3939
# Test when key is in fun_control and replace is False
40-
set_fun_control_key_value(fun_control, "key1", "value2")
40+
set_control_key_value(fun_control, "key1", "value2")
4141
assert fun_control["key1"] == "value1"
4242

4343
# Test when key is in fun_control and replace is True
44-
set_fun_control_key_value(fun_control, "key1", "value2", replace=True)
44+
set_control_key_value(fun_control, "key1", "value2", replace=True)
4545
assert fun_control["key1"] == "value2"
4646

4747
# Test when key is not in fun_control and replace is True
48-
set_fun_control_key_value(fun_control, "key2", "value3", replace=True)
48+
set_control_key_value(fun_control, "key2", "value3", replace=True)
4949
assert fun_control["key2"] == "value3"
5050

51-
def test_get_fun_control_key_value():
51+
def test_get_control_key_value():
5252
fun_control = fun_control_init()
5353

5454
# Test when key is not in fun_control
55-
assert get_fun_control_key_value(fun_control, "key1") is None
55+
assert get_control_key_value(fun_control, "key1") is None
5656

5757
# Test when fun_control is None
58-
assert get_fun_control_key_value() is None
58+
assert get_control_key_value() is None
5959

6060
# Test when key is in fun_control
61-
set_fun_control_key_value(fun_control, "key1", "value1")
62-
assert get_fun_control_key_value(fun_control, "key1") == "value1"
61+
set_control_key_value(fun_control, "key1", "value1")
62+
assert get_control_key_value(fun_control, "key1") == "value1"
6363

0 commit comments

Comments
 (0)