Skip to content
Snippets Groups Projects
Commit 890bc288 authored by bbauvin's avatar bbauvin
Browse files

Added main execution file

parent 994a0a62
Branches
Tags
No related merge requests found
...@@ -11,6 +11,7 @@ from joblib import Parallel, delayed ...@@ -11,6 +11,7 @@ from joblib import Parallel, delayed
import numpy as np import numpy as np
import math import math
import matplotlib import matplotlib
import h5py
# Import own modules # Import own modules
import Multiview import Multiview
...@@ -100,7 +101,7 @@ def initMonoviewKWARGS(args, classifiersNames): ...@@ -100,7 +101,7 @@ def initMonoviewKWARGS(args, classifiersNames):
return monoviewKWARGS return monoviewKWARGS
def initKWARGS(args, benchmark): def initKWARGSFunc(args, benchmark):
if "Monoview" in benchmark: if "Monoview" in benchmark:
monoviewKWARGS = initMonoviewKWARGS(args, benchmark["Monoview"]) monoviewKWARGS = initMonoviewKWARGS(args, benchmark["Monoview"])
else: else:
...@@ -108,20 +109,20 @@ def initKWARGS(args, benchmark): ...@@ -108,20 +109,20 @@ def initKWARGS(args, benchmark):
return monoviewKWARGS return monoviewKWARGS
def lateFusionSetArgs(views, viewsIndices, classes, method, # def lateFusionSetArgs(views, viewsIndices, classes, method,
classifiersNames, classifiersConfig, fusionMethodConfig): # classifiersNames, classifiersConfig, fusionMethodConfig):
arguments = {"CL_type": "Fusion", # arguments = {"CL_type": "Fusion",
"views": views, # "views": views,
"NB_VIEW": len(views), # "NB_VIEW": len(views),
"viewsIndices": viewsIndices, # "viewsIndices": viewsIndices,
"NB_CLASS": len(classes), # "NB_CLASS": len(classes),
"LABELS_NAMES": args.CL_classes, # "LABELS_NAMES": args.CL_classes,
"FusionKWARGS": {"fusionType": "LateFusion", "fusionMethod": method, # "FusionKWARGS": {"fusionType": "LateFusion", "fusionMethod": method,
"classifiersNames": classifiersNames, # "classifiersNames": classifiersNames,
"classifiersConfigs": classifiersConfig, # "classifiersConfigs": classifiersConfig,
'fusionMethodConfig': fusionMethodConfig, # 'fusionMethodConfig': fusionMethodConfig,
"nbView": (len(viewsIndices))}} # "nbView": (len(viewsIndices))}}
return arguments # return arguments
def initMultiviewArguments(args, benchmark, views, viewsIndices, argumentDictionaries, randomState, directory, def initMultiviewArguments(args, benchmark, views, viewsIndices, argumentDictionaries, randomState, directory,
...@@ -178,6 +179,7 @@ def classifyOneIter_multicore(LABELS_DICTIONARY, argumentDictionaries, nbCores, ...@@ -178,6 +179,7 @@ def classifyOneIter_multicore(LABELS_DICTIONARY, argumentDictionaries, nbCores,
labels = np.array( labels = np.array(
[resultMonoview[1][3] for resultMonoview in resultsMonoview] + [resultMultiview[3] for resultMultiview in [resultMonoview[1][3] for resultMonoview in resultsMonoview] + [resultMultiview[3] for resultMultiview in
resultsMultiview]).transpose() resultsMultiview]).transpose()
DATASET = h5py.File(args.pathF + args.name + str(0) + ".hdf5", "r")
trueLabels = DATASET.get("Labels").value trueLabels = DATASET.get("Labels").value
times = [dataBaseTime, monoviewTime, multiviewTime] times = [dataBaseTime, monoviewTime, multiviewTime]
results = (resultsMonoview, resultsMultiview) results = (resultsMonoview, resultsMultiview)
...@@ -273,10 +275,10 @@ def classifyOneIter(LABELS_DICTIONARY, argumentDictionaries, nbCores, directory, ...@@ -273,10 +275,10 @@ def classifyOneIter(LABELS_DICTIONARY, argumentDictionaries, nbCores, directory,
# _______________ # # _______________ #
# __ EXECUTION __ # # __ EXECUTION __ #
# _______________ # # _______________ #
def execClassif(arguments):
testVersions() testVersions()
start = time.time() start = time.time()
args = execution.parseTheArgs(sys.argv[1:]) args = execution.parseTheArgs(arguments)
os.nice(args.nice) os.nice(args.nice)
nbCores = args.CL_cores nbCores = args.CL_cores
...@@ -327,7 +329,7 @@ logging.info("Start:\t Finding all available mono- & multiview algorithms") ...@@ -327,7 +329,7 @@ logging.info("Start:\t Finding all available mono- & multiview algorithms")
benchmark = initBenchmark(args) benchmark = initBenchmark(args)
initKWARGS = initKWARGS(args, benchmark) initKWARGS = initKWARGSFunc(args, benchmark)
dataBaseTime = time.time() - start dataBaseTime = time.time() - start
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment