Skip to content
Snippets Groups Projects
Commit 19946122 authored by Baptiste Bauvin's avatar Baptiste Bauvin
Browse files

Working on multiple args

parent 4a3e213b
No related branches found
No related tags found
No related merge requests found
......@@ -156,6 +156,9 @@ def initMonoviewExps(benchmark, viewsDictionary, nbClass, kwargsInit):
argumentDictionaries["Monoview"] = []
for viewName, viewIndex in viewsDictionary.items():
for classifier in benchmark["Monoview"]:
if multiple_args(classifier, kwargsInit):
argumentDictionaries["Monoview"] += gen_multiple_args_dictionnaries(nbClass, kwargsInit)
else:
arguments = {
"args": {classifier + "KWARGS": kwargsInit[
classifier + "KWARGSInit"], "feat": viewName,
......@@ -164,6 +167,16 @@ def initMonoviewExps(benchmark, viewsDictionary, nbClass, kwargsInit):
argumentDictionaries["Monoview"].append(arguments)
return argumentDictionaries
def multiple_args(classifier, kwargsInit):
listed_args = [type(value) == list and len(value)>1 for key, value in kwargsInit[classifier + "KWARGSInit"].items()]
if True in listed_args:
return True
else:
return False
def gen_multiple_args_dictionnaries(nbClass, kwargsInit):
def initMonoviewKWARGS(args, classifiersNames):
r"""Used to init kwargs thanks to a function in each monoview classifier package.
......@@ -600,6 +613,7 @@ def execClassif(arguments):
metrics[metricIndex] = [metric[0], None]
benchmark = initBenchmark(CL_type, monoviewAlgos, multiviewAlgos, args)
print(benchmark, "\n")
initKWARGS = initKWARGSFunc(args, benchmark)
......@@ -607,6 +621,7 @@ def execClassif(arguments):
argumentDictionaries = initMonoviewExps(benchmark, viewsDictionary,
NB_CLASS, initKWARGS)
print(argumentDictionaries, "\n")
directories = execution.genDirecortiesNames(directory, statsIter)
benchmarkArgumentDictionaries = execution.genArgumentDictionaries(
LABELS_DICTIONARY, directories, multiclassLabels,
......@@ -615,6 +630,7 @@ def execClassif(arguments):
statsIterRandomStates, metrics,
argumentDictionaries, benchmark, nbViews,
views, viewsIndices)
print(benchmarkArgumentDictionaries, "\n")
nbMulticlass = len(labelsCombinations)
execBenchmark(nbCores, statsIter, nbMulticlass,
......
......@@ -131,7 +131,7 @@ def getPlausibleDBhdf5(features, pathF, name, NB_CLASS=3, LABELS_NAME="",
datasetFile.close()
datasetFile = h5py.File(pathF + "Plausible.hdf5", "r")
LABELS_DICTIONARY = {0: "No", 1: "Yes"}
return datasetFile, LABELS_DICTIONARY
return datasetFile, LABELS_DICTIONARY, "Plausible"
elif NB_CLASS >= 3:
firstBound = int(datasetLength / 3)
rest = datasetLength - 2 * int(datasetLength / 3)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment