Skip to content
Snippets Groups Projects
Commit 59146432 authored by Dominique Benielli's avatar Dominique Benielli
Browse files

test iP

parent 733eb98d
Branches
Tags
No related merge requests found
...@@ -310,7 +310,7 @@ def get_classic_db_hdf5(views, path_f, name_DB, nb_class, asked_labels_names, ...@@ -310,7 +310,7 @@ def get_classic_db_hdf5(views, path_f, name_DB, nb_class, asked_labels_names,
noise_std) noise_std)
else: else:
pass pass
return dataset, labels_dictionary, dataset_name return dataset_file, labels_dictionary, dataset_name
def add_gaussian_noise(dataset_file, random_state, path_f, dataset_name, def add_gaussian_noise(dataset_file, random_state, path_f, dataset_name,
......
...@@ -6,7 +6,7 @@ import numpy as np ...@@ -6,7 +6,7 @@ import numpy as np
from .utils import rm_tmp, tmp_path from .utils import rm_tmp, tmp_path
from ..mono_multi_view_classifiers import exec_classif from multiview_platform.mono_multi_view_classifiers import exec_classif
class Test_initBenchmark(unittest.TestCase): class Test_initBenchmark(unittest.TestCase):
...@@ -232,7 +232,7 @@ class Test_execBenchmark(unittest.TestCase): ...@@ -232,7 +232,7 @@ class Test_execBenchmark(unittest.TestCase):
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):
rm_tmp() rm_tmp()
os.mkdir("multiview_platform/tests/tmp_tests") os.mkdir("./tests/tmp_tests")
cls.Dataset = h5py.File( cls.Dataset = h5py.File(
tmp_path+"test_file.hdf5", "w") tmp_path+"test_file.hdf5", "w")
cls.labels = cls.Dataset.create_dataset("Labels", cls.labels = cls.Dataset.create_dataset("Labels",
...@@ -333,10 +333,10 @@ class FakeKfold(): ...@@ -333,10 +333,10 @@ class FakeKfold():
class Test_execOneBenchmark(unittest.TestCase): class Test_execOneBenchmark(unittest.TestCase):
@classmethod @classmethod
def setUp(cls): def setUp(cls):
rm_tmp() rm_tmp()
os.mkdir("multiview_platform/tests/tmp_tests") print(os.getcwd())
os.mkdir("../tests/tmp_tests")
cls.args = { cls.args = {
"Base": {"name": "chicken_is_heaven", "type": "type", "Base": {"name": "chicken_is_heaven", "type": "type",
"pathf": "pathF"}, "pathf": "pathF"},
...@@ -403,7 +403,7 @@ class Test_execOneBenchmark_multicore(unittest.TestCase): ...@@ -403,7 +403,7 @@ class Test_execOneBenchmark_multicore(unittest.TestCase):
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):
rm_tmp() rm_tmp()
os.mkdir("multiview_platform/tests/tmp_tests") os.mkdir("./tests/tmp_tests")
cls.args = { cls.args = {
"Base": {"name": "chicken_is_heaven", "type": "type", "Base": {"name": "chicken_is_heaven", "type": "type",
"pathf": "pathF"}, "pathf": "pathF"},
...@@ -809,3 +809,6 @@ class Test_get_path_dict(unittest.TestCase): ...@@ -809,3 +809,6 @@ class Test_get_path_dict(unittest.TestCase):
# suite.addTest(Test_initBenchmark('test_initKWARGSFunc_no_monoview')) # suite.addTest(Test_initBenchmark('test_initKWARGSFunc_no_monoview'))
# # suite.addTest(WidgetTestCase('test_widget_resize')) # # suite.addTest(WidgetTestCase('test_widget_resize'))
# return suite # return suite
if __name__ == '__main__':
unittest.main()
\ No newline at end of file
...@@ -68,3 +68,7 @@ class Test_DiversityFusion(unittest.TestCase): ...@@ -68,3 +68,7 @@ class Test_DiversityFusion(unittest.TestCase):
classifier_names=self.classifier_names, classifier_names=self.classifier_names,
classifiers_config=self.classifiers_config) classifiers_config=self.classifiers_config)
clf.fit(self.X, self.y, self.train_indices, self.views_indices) clf.fit(self.X, self.y, self.train_indices, self.views_indices)
if __name__ == '__main__':
unittest.main()
\ No newline at end of file
This diff is collapsed.
...@@ -13,7 +13,7 @@ class Test_get_the_args(unittest.TestCase): ...@@ -13,7 +13,7 @@ class Test_get_the_args(unittest.TestCase):
def setUpClass(cls): def setUpClass(cls):
rm_tmp() rm_tmp()
cls.path_to_config_file = tmp_path+"config_temp.yml" cls.path_to_config_file = tmp_path+"config_temp.yml"
os.mkdir("multiview_platform/tests/tmp_tests") os.mkdir("./multiview_platform/tests/tmp_tests")
data = {"Base":{"first_arg": 10, "second_arg":[12.5, 1e-06]}, "Classification":{"third_arg":True}} data = {"Base":{"first_arg": 10, "second_arg":[12.5, 1e-06]}, "Classification":{"third_arg":True}}
with open(cls.path_to_config_file, "w") as config_file: with open(cls.path_to_config_file, "w") as config_file:
yaml.dump(data, config_file) yaml.dump(data, config_file)
...@@ -74,3 +74,5 @@ class Test_get_the_args(unittest.TestCase): ...@@ -74,3 +74,5 @@ class Test_get_the_args(unittest.TestCase):
# value = configuration.format_raw_arg("list_str ; list string") # value = configuration.format_raw_arg("list_str ; list string")
# self.assertEqual(value, ["list", "string"]) # self.assertEqual(value, ["list", "string"])
if __name__ == '__main__':
unittest.main()
\ No newline at end of file
...@@ -95,3 +95,6 @@ class Test_Dataset(unittest.TestCase): ...@@ -95,3 +95,6 @@ class Test_Dataset(unittest.TestCase):
self.assertEqual(dataset_object.get_view_dict(), {"ViewN0":0, self.assertEqual(dataset_object.get_view_dict(), {"ViewN0":0,
"ViewN1": 1, "ViewN1": 1,
"ViewN2": 2,}) "ViewN2": 2,})
if __name__ == '__main__':
unittest.main()
\ No newline at end of file
...@@ -225,3 +225,6 @@ class Test_genArgumentDictionaries(unittest.TestCase): ...@@ -225,3 +225,6 @@ class Test_genArgumentDictionaries(unittest.TestCase):
np.array([0, 1, -100, 0, 1])] np.array([0, 1, -100, 0, 1])]
cls.labelsCombinations = [[0, 1], [0, 2], [1, 2]] cls.labelsCombinations = [[0, 1], [0, 2], [1, 2]]
cls.indicesMulticlass = [[[[], []], [[], []], [[], []]], [[], [], []]] cls.indicesMulticlass = [[[[], []], [[], []], [[], []]], [[], [], []]]
if __name__ == '__main__':
unittest.main()
\ No newline at end of file
...@@ -56,3 +56,9 @@ class Test_randomized_search(unittest.TestCase): ...@@ -56,3 +56,9 @@ class Test_randomized_search(unittest.TestCase):
self.dataset_file, self.labels.value, "multiview", self.random_state, tmp_path, self.dataset_file, self.labels.value, "multiview", self.random_state, tmp_path,
weighted_linear_early_fusion, "WeightedLinearEarlyFusion", self.k_folds, weighted_linear_early_fusion, "WeightedLinearEarlyFusion", self.k_folds,
1, ["accuracy_score", None], 2, {}, learning_indices=self.learning_indices) 1, ["accuracy_score", None], 2, {}, learning_indices=self.learning_indices)
if __name__ == '__main__':
# unittest.main()
suite = unittest.TestLoader().loadTestsFromTestCase(Test_randomized_search)
unittest.TextTestRunner(verbosity=2).run(suite)
\ No newline at end of file
...@@ -43,3 +43,6 @@ class Test_genMulticlassLabels(unittest.TestCase): ...@@ -43,3 +43,6 @@ class Test_genMulticlassLabels(unittest.TestCase):
-100, -100,
1, -100, 0, 0, 1, 0, -100, 0, 1, -100, 0, 0, 1, 0, -100, 0,
-100])) -100]))
if __name__ == '__main__':
unittest.main()
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment