Skip to content

Commit d626326

Browse files
impo threshold
1 parent 76011e0 commit d626326

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

src/spotPython/spot/spot.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1464,7 +1464,7 @@ def plot_contour(
14641464
if show:
14651465
pylab.show()
14661466

1467-
def plot_important_hyperparameter_contour(self, threshold=0.025, filename=None, show=True) -> None:
1467+
def plot_important_hyperparameter_contour(self, threshold=0.025, filename=None, show=True, max_imp=None) -> None:
14681468
"""
14691469
Plot the contour of important hyperparameters.
14701470
Calls `plot_contour` for each pair of important hyperparameters.
@@ -1477,6 +1477,9 @@ def plot_important_hyperparameter_contour(self, threshold=0.025, filename=None,
14771477
filename of the plot
14781478
show (bool):
14791479
show the plot. Default is `True`.
1480+
max_imp (int):
1481+
maximum number of important hyperparameters. If there are more important hyperparameters
1482+
than `max_imp`, only the max_imp important ones are selected.
14801483
14811484
Returns:
14821485
None.
@@ -1510,6 +1513,12 @@ def plot_important_hyperparameter_contour(self, threshold=0.025, filename=None,
15101513
15111514
"""
15121515
impo = self.print_importance(threshold=threshold, print_screen=True)
1516+
print(f"impo: {impo}")
1517+
# if there are more than imp_max variables, select only the most important ones:
1518+
if max_imp is not None:
1519+
if len(impo) > max_imp:
1520+
impo = impo[:max_imp]
1521+
print(f"impo after select: {impo}")
15131522
var_plots = [i for i, x in enumerate(impo) if x[1] > threshold]
15141523
min_z = min(self.y)
15151524
max_z = max(self.y)

0 commit comments

Comments
 (0)