@@ -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