Skip to content

Commit dd9ae06

Browse files
0.14.71
plot with min and max
1 parent c0b3f46 commit dd9ae06

2 files changed

Lines changed: 25 additions & 8 deletions

File tree

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.14.70"
10+
version = "0.14.71"
1111
authors = [
1212
{ name="T. Bartz-Beielstein", email="tbb@bartzundbartz.de" }
1313
]

src/spotPython/spot/spot.py

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1894,6 +1894,8 @@ def plot_contour(
18941894
dpi=200,
18951895
title="",
18961896
figsize=(12, 6),
1897+
use_min=False,
1898+
use_max=True,
18971899
) -> None:
18981900
"""Plot the contour of any dimension."""
18991901

@@ -1938,13 +1940,26 @@ def plot_contour_subplots(X, Y, Z, ax, min_z, max_z, contour_levels):
19381940
validate_types(self.var_type, self.lower, self.upper)
19391941

19401942
z00 = np.array([self.lower, self.upper])
1941-
z0_min = self.process_z00(z00, use_min=True)
1942-
Z_min = predict_contour_values(X, Y, z0_min)
1943-
z0_max = self.process_z00(z00, use_min=False)
1944-
Z_max = predict_contour_values(X, Y, z0_max)
1945-
Z_combined = np.vstack((Z_min, Z_max))
1946-
X_combined = np.vstack((X, X))
1947-
Y_combined = np.vstack((Y, Y))
1943+
Z_list, X_list, Y_list = [], [], []
1944+
1945+
if use_min:
1946+
z0_min = self.process_z00(z00, use_min=True)
1947+
Z_min = predict_contour_values(X, Y, z0_min)
1948+
Z_list.append(Z_min)
1949+
X_list.append(X)
1950+
Y_list.append(Y)
1951+
1952+
if use_max:
1953+
z0_max = self.process_z00(z00, use_min=False)
1954+
Z_max = predict_contour_values(X, Y, z0_max)
1955+
Z_list.append(Z_max)
1956+
X_list.append(X)
1957+
Y_list.append(Y)
1958+
1959+
if Z_list: # Ensure that there is at least one Z to stack
1960+
Z_combined = np.vstack(Z_list)
1961+
X_combined = np.vstack(X_list)
1962+
Y_combined = np.vstack(Y_list)
19481963

19491964
if min_z is None:
19501965
min_z = np.min(Z_combined)
@@ -2098,6 +2113,8 @@ def plot_important_hyperparameter_contour(
20982113
n_grid=n_grid,
20992114
contour_levels=contour_levels,
21002115
dpi=dpi,
2116+
use_max=use_max,
2117+
use_min=use_min,
21012118
)
21022119

21032120
def get_importance(self) -> list:

0 commit comments

Comments
 (0)