From becc42e889c315b37a81eefcc7d3c39b712abf9e Mon Sep 17 00:00:00 2001 From: SabaFathi <39127848+SabaFathi@users.noreply.github.com> Date: Fri, 15 Aug 2025 16:19:44 +1000 Subject: [PATCH] Allow data_generator.py to run without classical datasets for customized data Previously, users needed to download classical datasets even when using their own custom datasets. This update removes that requirement, enabling the code to work solely with user-provided datasets. --- adbench/datasets/data_generator.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/adbench/datasets/data_generator.py b/adbench/datasets/data_generator.py index c4512f1..21595cf 100644 --- a/adbench/datasets/data_generator.py +++ b/adbench/datasets/data_generator.py @@ -33,7 +33,7 @@ def __init__(self, seed:int=42, dataset:str=None, test_size:float=0.3, self.n_samples_threshold = n_samples_threshold # dataset list - self.dataset_list_classical, self.dataset_list_cv, self.dataset_list_nlp = self.generate_dataset_list() + # self.dataset_list_classical, self.dataset_list_cv, self.dataset_list_nlp = self.generate_dataset_list() # myutils function self.utils = Utils() @@ -232,6 +232,8 @@ def generator(self, X=None, y=None, minmax=True, assert X is not None and y is not None, "For customized dataset, you should provide the X and y!" print('Testing on customized dataset...') else: + self.dataset_list_classical, self.dataset_list_cv, self.dataset_list_nlp = self.generate_dataset_list() + if self.dataset in self.dataset_list_classical: data = np.load(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'Classical', self.dataset + '.npz'), allow_pickle=True) elif self.dataset in self.dataset_list_cv: @@ -368,4 +370,4 @@ def generator(self, X=None, y=None, minmax=True, y_train[idx_unlabeled] = 0 y_train[idx_labeled_anomaly] = 1 - return {'X_train':X_train, 'y_train':y_train, 'X_test':X_test, 'y_test':y_test} \ No newline at end of file + return {'X_train':X_train, 'y_train':y_train, 'X_test':X_test, 'y_test':y_test}