Skip to content

Commit 8ee0e63

Browse files
committed
Fix bug metacluster
1 parent 6fe260e commit 8ee0e63

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

metacluster/metacluster.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def _set_list_function(self, list_obj=None, name="objectives"):
119119
list_obj0.append(obj)
120120
if len(list_obj0) > 0:
121121
print(f"MetaCluster doesn't support {name}: {list_obj0}")
122-
self.list_obj = list_obj1
122+
return list_obj1
123123

124124
def _set_list_optimizer(self, list_optimizer=None, list_paras=None):
125125
if type(list_optimizer) not in (list, tuple):
@@ -200,7 +200,8 @@ def execute(self, data=None, cluster_finder="elbow", list_metric=None, save_path
200200
"""
201201
## Set up optimizer and objectives
202202
self._set_list_optimizer(self.list_optimizer, self.list_paras)
203-
self._set_list_function(self.list_obj, name="objectives")
203+
self.list_obj = self._set_list_function(self.list_obj, name="objectives")
204+
self.list_metric = self._set_list_function(list_metric, name="metrics")
204205

205206
if data.y is not None:
206207
n_clusters = len(np.unique(data.y))
@@ -211,7 +212,6 @@ def execute(self, data=None, cluster_finder="elbow", list_metric=None, save_path
211212
lb = np.min(data.X, axis=0).tolist() * n_clusters
212213
ub = np.max(data.X, axis=0).tolist() * n_clusters
213214
bound = mu.FloatVar(lb=lb, ub=ub, name="center_weights")
214-
self.list_metric = self._set_list_function(list_metric, name="metrics")
215215

216216
## Check parent directories
217217
self.save_path = f"{save_path}/{data.get_name()}"
@@ -280,31 +280,31 @@ def save_boxplots(self, figure_size=None, xlabel="Optimizer", list_ylabel=None,
280280
281281
Parameters
282282
----------
283-
figure_size : list, tuple, np.ndarray, None; default=None
283+
figure_size : list, tuple, np.ndarray, None, default=None
284284
The size for saved figures. `None` means it will automatically set for you.
285285
Or you can pass (width, height) of figure based on pixel (100px to 1500px)
286286
287-
xlabel : str; default="Optimizer"
287+
xlabel : str, default="Optimizer"
288288
The label for x coordinate of boxplot figures.
289289
290-
list_ylabel : list, tuple, np.ndarray, None; default=None
290+
list_ylabel : list, tuple, np.ndarray, None, default=None
291291
The label for y coordinate of boxplot figures. Each boxplot corresponding to each metric in list_metric parameter,
292292
therefor, if you wish to change to y label, you need to pass a list of string represent all metrics in order of list_metric.
293293
None means it will use the name of metrics as the label
294294
295-
title : str; default="Boxplot of comparison models"
295+
title : str, default="Boxplot of comparison models"
296296
The title of figures, it should be the same for all objectives since we have y coordinate already difference.
297297
298-
show_legend : bool; default=True
298+
show_legend : bool, default=True
299299
Show the legend or not. For boxplots we can turn on or off this option, but not for convergence chart.
300300
301-
show_mean_only : bool; default=False
301+
show_mean_only : bool, default=False
302302
You can show the mean value only or you can show all mean, std, median of the box by this parameter
303303
304-
exts : list, tuple, np.ndarray; default=(".png", ".pdf")
304+
exts : list, tuple, np.ndarray, default=(".png", ".pdf")
305305
List of extensions of the figures. It is for multiple purposes such as latex (need ".pdf" format), word (need ".png" format).
306306
307-
file_name : str; default="boxplot"
307+
file_name : str, default="boxplot"
308308
The prefix for filenames that will be saved.
309309
"""
310310
if type(figure_size) in (list, tuple, np.ndarray):
@@ -332,25 +332,25 @@ def save_convergences(self, figure_size=None, xlabel="Epoch", list_ylabel=None,
332332
333333
Parameters
334334
----------
335-
figure_size : list, tuple, np.ndarray, None; default=None
335+
figure_size : list, tuple, np.ndarray, None, default=None
336336
The size for saved figures. `None` means it will automatically set for you.
337337
Or you can pass (width, height) of figure based on pixel (100px to 1500px)
338338
339-
xlabel : str; default="Optimizer"
339+
xlabel : str, default="Optimizer"
340340
The label for x coordinate of convergence figures.
341341
342-
list_ylabel : list, tuple, np.ndarray, None; default=None
342+
list_ylabel : list, tuple, np.ndarray, None, default=None
343343
The label for y coordinate of convergence figures. Each convergence corresponding to each objective in list_obj,
344344
therefor, if you wish to change to y label, you need to pass a list of string represent all objectives in order of list_obj.
345345
None means it will use the name of objectives as the label
346346
347-
title : str; default="Convergence chart of comparison models"
347+
title : str, default="Convergence chart of comparison models"
348348
The title of figures, it should be the same for all objectives since we have y coordinate already difference.
349349
350-
exts : list, tuple, np.ndarray; default=(".png", ".pdf")
350+
exts : list, tuple, np.ndarray, default=(".png", ".pdf")
351351
List of extensions of the figures. It is for multiple purposes such as latex (need ".pdf" format), word (need ".png" format).
352352
353-
file_name : str; default="convergence"
353+
file_name : str, default="convergence"
354354
The prefix for filenames that will be saved.
355355
"""
356356
if type(figure_size) in (list, tuple, np.ndarray):

0 commit comments

Comments
 (0)