diff --git a/multiview_platform/mono_multi_view_classifiers/utils/get_multiview_db.py b/multiview_platform/mono_multi_view_classifiers/utils/get_multiview_db.py index c4c5d376cb7960e244413b1f1e76ca34b75a5c19..0aec7f32fdf001264e18ff87aaa7af73a9529119 100644 --- a/multiview_platform/mono_multi_view_classifiers/utils/get_multiview_db.py +++ b/multiview_platform/mono_multi_view_classifiers/utils/get_multiview_db.py @@ -285,7 +285,7 @@ def get_classic_db_hdf5(views, path_f, name_DB, nb_class, asked_labels_names, dataset_name = dataset.get_name() else: pass - return dataset_file, labels_dictionary, dataset_name + return dataset, labels_dictionary, dataset_name # # def add_gaussian_noise(dataset_file, random_state, path_f, dataset_name, diff --git a/multiview_platform/tests/test_ExecClassif.py b/multiview_platform/tests/test_ExecClassif.py index 71f53c9948fe44f0ca550b35dbdaad7e7d584ea3..84f4c5f50e1c0dc51e65ac729f6c34efbc8abde4 100644 --- a/multiview_platform/tests/test_ExecClassif.py +++ b/multiview_platform/tests/test_ExecClassif.py @@ -328,8 +328,7 @@ class Test_execOneBenchmark(unittest.TestCase): @classmethod def setUp(cls): rm_tmp() - print(os.getcwd()) - os.mkdir("../tests/tmp_tests") + os.mkdir(tmp_path) cls.args = { "Base": {"name": "chicken_is_heaven", "type": "type", "pathf": "pathF"}, @@ -396,7 +395,7 @@ class Test_execOneBenchmark_multicore(unittest.TestCase): @classmethod def setUpClass(cls): rm_tmp() - os.mkdir("./tests/tmp_tests") + os.mkdir(tmp_path) cls.args = { "Base": {"name": "chicken_is_heaven", "type": "type", "pathf": "pathF"}, diff --git a/multiview_platform/tests/test_mono_view/test_ExecClassifMonoView.py b/multiview_platform/tests/test_mono_view/test_ExecClassifMonoView.py index 469adf7d3e89e9cfdbcc6cc9f216b2338bae4d71..1e1625ae0e293c550ad53e625eecc8796d440522 100644 --- a/multiview_platform/tests/test_mono_view/test_ExecClassifMonoView.py +++ b/multiview_platform/tests/test_mono_view/test_ExecClassifMonoView.py @@ -16,7 +16,7 @@ class Test_initConstants(unittest.TestCase): @classmethod def setUpClass(cls): rm_tmp() - os.mkdir("multiview_platform/tests/tmp_tests") + os.mkdir(tmp_path) cls.view_name="test_dataset" cls.datasetFile = h5py.File( tmp_path+"test.hdf5", "w") @@ -63,7 +63,7 @@ class Test_initConstants(unittest.TestCase): tmp_path+"test_dir/test_clf/test_dataset") os.rmdir(tmp_path+"test_dir/test_clf") os.rmdir(tmp_path+"test_dir") - os.rmdir("multiview_platform/tests/tmp_tests") + os.rmdir(tmp_path) class Test_initTrainTest(unittest.TestCase): @@ -103,7 +103,7 @@ class Test_getHPs(unittest.TestCase): @classmethod def setUpClass(cls): rm_tmp() - os.mkdir("multiview_platform/tests/tmp_tests") + os.mkdir(tmp_path) cls.classifierModule = decision_tree cls.hyper_param_search = "randomized_search" cls.n_iter = 2 @@ -122,10 +122,10 @@ class Test_getHPs(unittest.TestCase): @classmethod def tearDownClass(cls): - for file_name in os.listdir("multiview_platform/tests/tmp_tests"): + for file_name in os.listdir(tmp_path): os.remove( - os.path.join("multiview_platform/tests/tmp_tests", file_name)) - os.rmdir("multiview_platform/tests/tmp_tests") + os.path.join(tmp_path, file_name)) + os.rmdir(tmp_path) def test_simple(self): kwargs, test_folds_predictions = exec_classif_mono_view.getHPs(self.classifierModule, diff --git a/multiview_platform/tests/test_utils/test_configuration.py b/multiview_platform/tests/test_utils/test_configuration.py index 9285155c817ee91b1e62a694d516b87c99792e27..5e487e769c7dc6ecdb7753a3c61630d0c62d223f 100644 --- a/multiview_platform/tests/test_utils/test_configuration.py +++ b/multiview_platform/tests/test_utils/test_configuration.py @@ -21,7 +21,7 @@ class Test_get_the_args(unittest.TestCase): @classmethod def tearDownClass(cls): os.remove(tmp_path+"config_temp.yml") - os.rmdir("multiview_platform/tests/tmp_tests") + os.rmdir(tmp_path) def test_file_loading(self): config_dict = configuration.get_the_args(self.path_to_config_file) diff --git a/multiview_platform/tests/test_utils/test_execution.py b/multiview_platform/tests/test_utils/test_execution.py index 8848dc56907ee1a2bce106c9589b9c775e13ffbc..3a351de12f7dfd5ac9846fb5fd68a96016b18599 100644 --- a/multiview_platform/tests/test_utils/test_execution.py +++ b/multiview_platform/tests/test_utils/test_execution.py @@ -196,22 +196,22 @@ class Test_genDirecortiesNames(unittest.TestCase): @classmethod def setUpClass(cls): - cls.directory = "../chicken_is_heaven/" + cls.directory = tmp_path cls.stats_iter = 5 def test_simple_ovo(cls): directories = execution.gen_direcorties_names(cls.directory, cls.stats_iter) cls.assertEqual(len(directories), 5) - cls.assertEqual(directories[0], "../chicken_is_heaven/iter_1/") - cls.assertEqual(directories[-1], "../chicken_is_heaven/iter_5/") + cls.assertEqual(directories[0], os.path.join(tmp_path, "iter_1/")) + cls.assertEqual(directories[-1], os.path.join(tmp_path, "iter_5/")) def test_ovo_no_iter(cls): cls.stats_iter = 1 directories = execution.gen_direcorties_names(cls.directory, cls.stats_iter) cls.assertEqual(len(directories), 1) - cls.assertEqual(directories[0], "../chicken_is_heaven/") + cls.assertEqual(directories[0], tmp_path) class Test_genArgumentDictionaries(unittest.TestCase): diff --git a/multiview_platform/tests/test_utils/test_hyper_parameter_search.py b/multiview_platform/tests/test_utils/test_hyper_parameter_search.py index edc164fa75046d197e0d9b597ec35c4b200b609d..4917c207ce7e1cf87fbc080430df99225e306a38 100644 --- a/multiview_platform/tests/test_utils/test_hyper_parameter_search.py +++ b/multiview_platform/tests/test_utils/test_hyper_parameter_search.py @@ -18,7 +18,7 @@ class Test_randomized_search(unittest.TestCase): rm_tmp() cls.random_state = np.random.RandomState(42) cls.view_weights = [0.5, 0.5] - os.mkdir("multiview_platform/tests/tmp_tests") + os.mkdir(tmp_path) cls.dataset_file = h5py.File( tmp_path+"test_file.hdf5", "w") cls.labels = cls.dataset_file.create_dataset("Labels", @@ -49,10 +49,7 @@ class Test_randomized_search(unittest.TestCase): @classmethod def tearDownClass(cls): cls.dataset_file.close() - for file_name in os.listdir("multiview_platform/tests/tmp_tests"): - os.remove( - os.path.join("multiview_platform/tests/tmp_tests", file_name)) - os.rmdir("multiview_platform/tests/tmp_tests") + rm_tmp() def test_simple(self): diff --git a/multiview_platform/tests/utils.py b/multiview_platform/tests/utils.py index 5a373caeb54edfdcb4212e4d3b4da5bf2953a8f7..1b39abf11e3810f31c827a931b2836fda5d86620 100644 --- a/multiview_platform/tests/utils.py +++ b/multiview_platform/tests/utils.py @@ -5,8 +5,8 @@ import h5py from ..mono_multi_view_classifiers.utils.dataset import Dataset -tmp_path = "multiview_platform/tests/tmp_tests/" -test_dataset = Dataset(hdf5_file=h5py.File("multiview_platform/tests/test_database.hdf5", "r")) +tmp_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "tmp_tests/") +test_dataset = Dataset(hdf5_file=h5py.File(os.path.join(os.path.dirname(os.path.abspath(__file__)), "test_database.hdf5"), "r")) def rm_tmp(): try: diff --git a/setup.py b/setup.py index fcb010b8c4e8feab77dac5d76dc16baebcdc9bc0..3bc02d0f1fa3a6d2d666ac213262ba4f34a77a6d 100644 --- a/setup.py +++ b/setup.py @@ -52,7 +52,7 @@ def setup_package(): # dependency_links=['https://github.com/aldro61/pyscm.git#egg=pyscm'], # Une url qui pointe vers la page officielle de votre lib url='http://github.com/babau1/multiview-machine-learning-omis/', - install_requires=['numpy>=1.8', 'scipy>=0.16','scikit-learn==0.19', + install_requires=['numpy>=1.16', 'scipy>=0.16','scikit-learn==0.19', 'matplotlib', 'h5py', 'joblib', 'pandas', 'm2r', 'pyyaml', 'pyscm @ git+https://github.com/aldro61/pyscm', 'cvxopt'],