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

Working

parent 00016ceb
Branches
Tags
No related merge requests found
Showing
with 27 additions and 3 deletions
...@@ -166,6 +166,9 @@ class BaseMonoviewClassifier(object): ...@@ -166,6 +166,9 @@ class BaseMonoviewClassifier(object):
", feature importance : " + str(featureImportance) + "\n" ", feature importance : " + str(featureImportance) + "\n"
return interpretString return interpretString
def get_name_for_fusion(self):
return self.__class__.__name__[:4]
def get_names(classed_list): def get_names(classed_list):
return np.array([object_.__class__.__name__ for object_ in classed_list]) return np.array([object_.__class__.__name__ for object_ in classed_list])
......
...@@ -79,6 +79,9 @@ class CQBoostv2(ColumnGenerationClassifierv2, BaseMonoviewClassifier): ...@@ -79,6 +79,9 @@ class CQBoostv2(ColumnGenerationClassifierv2, BaseMonoviewClassifier):
def getInterpret(self, directory): def getInterpret(self, directory):
return getInterpretBase(self, directory, "CQBoostv2", self.weights_,) return getInterpretBase(self, directory, "CQBoostv2", self.weights_,)
def get_name_for_fusion(self):
return "CQB2"
def formatCmdArgs(args): def formatCmdArgs(args):
"""Used to format kwargs for the parsed args""" """Used to format kwargs for the parsed args"""
......
...@@ -261,6 +261,9 @@ class CQBoostv21(CqBoostClassifierv21, BaseMonoviewClassifier): ...@@ -261,6 +261,9 @@ class CQBoostv21(CqBoostClassifierv21, BaseMonoviewClassifier):
def getInterpret(self, directory): def getInterpret(self, directory):
return getInterpretBase(self, directory, "CQBoostv21", self.weights_, self.break_cause) return getInterpretBase(self, directory, "CQBoostv21", self.weights_, self.break_cause)
def get_name_for_fusion(self):
return "CQ21"
def formatCmdArgs(args): def formatCmdArgs(args):
"""Used to format kwargs for the parsed args""" """Used to format kwargs for the parsed args"""
......
...@@ -23,6 +23,9 @@ class QarBoostNC(ColumnGenerationClassifierQar, BaseMonoviewClassifier): ...@@ -23,6 +23,9 @@ class QarBoostNC(ColumnGenerationClassifierQar, BaseMonoviewClassifier):
def getInterpret(self, directory): def getInterpret(self, directory):
return getInterpretBase(self, directory, "QarBoostNC", self.weights_, self.break_cause) return getInterpretBase(self, directory, "QarBoostNC", self.weights_, self.break_cause)
def get_name_for_fusion(self):
return "QBNC"
def formatCmdArgs(args): def formatCmdArgs(args):
"""Used to format kwargs for the parsed args""" """Used to format kwargs for the parsed args"""
......
...@@ -23,6 +23,9 @@ class QarBoostNC2(ColumnGenerationClassifierQar, BaseMonoviewClassifier): ...@@ -23,6 +23,9 @@ class QarBoostNC2(ColumnGenerationClassifierQar, BaseMonoviewClassifier):
def getInterpret(self, directory): def getInterpret(self, directory):
return getInterpretBase(self, directory, "QarBoostNC2", self.weights_, self.break_cause) return getInterpretBase(self, directory, "QarBoostNC2", self.weights_, self.break_cause)
def get_name_for_fusion(self):
return "QBN2"
def formatCmdArgs(args): def formatCmdArgs(args):
"""Used to format kwargs for the parsed args""" """Used to format kwargs for the parsed args"""
......
...@@ -23,6 +23,9 @@ class QarBoostv2(ColumnGenerationClassifierQar, BaseMonoviewClassifier): ...@@ -23,6 +23,9 @@ class QarBoostv2(ColumnGenerationClassifierQar, BaseMonoviewClassifier):
def getInterpret(self, directory): def getInterpret(self, directory):
return getInterpretBase(self, directory, "QarBoostv2", self.weights_, self.break_cause) return getInterpretBase(self, directory, "QarBoostv2", self.weights_, self.break_cause)
def get_name_for_fusion(self):
return "QBv2"
def formatCmdArgs(args): def formatCmdArgs(args):
"""Used to format kwargs for the parsed args""" """Used to format kwargs for the parsed args"""
......
...@@ -50,6 +50,9 @@ class QarBoostv3(ColumnGenerationClassifierQar3, BaseMonoviewClassifier): ...@@ -50,6 +50,9 @@ class QarBoostv3(ColumnGenerationClassifierQar3, BaseMonoviewClassifier):
def getInterpret(self, directory): def getInterpret(self, directory):
return getInterpretBase(self, directory, "QarBoostv3", self.weights_, self.break_cause) return getInterpretBase(self, directory, "QarBoostv3", self.weights_, self.break_cause)
def get_name_for_fusion(self):
return "QBv3"
def formatCmdArgs(args): def formatCmdArgs(args):
"""Used to format kwargs for the parsed args""" """Used to format kwargs for the parsed args"""
kwargsDict = {} kwargsDict = {}
......
...@@ -23,7 +23,9 @@ def genName(config): ...@@ -23,7 +23,9 @@ def genName(config):
classifierRedNames = [classifierName[:4] for classifierName in config["classifiersNames"]] classifierRedNames = [classifierName[:4] for classifierName in config["classifiersNames"]]
return "Late-" + str(config["fusionMethod"][:4])#+"-"+"-".join(classifierRedNames) return "Late-" + str(config["fusionMethod"][:4])#+"-"+"-".join(classifierRedNames)
elif config["fusionType"] == "EarlyFusion": elif config["fusionType"] == "EarlyFusion":
return "Early-" + config["fusionMethod"][:4] + "-" + config["classifiersNames"][:4] monoview_short_name = getattr(getattr(MonoviewClassifiers, config["classifiersNames"]),
config["classifiersNames"])().get_name_for_fusion()
return "Early-" + config["fusionMethod"][:4] + "-" + monoview_short_name
def getBenchmark(benchmark, args=None): def getBenchmark(benchmark, args=None):
......
...@@ -425,6 +425,7 @@ def publishIterBiclassMetricsScores(iterResults, directory, labelsDictionary, cl ...@@ -425,6 +425,7 @@ def publishIterBiclassMetricsScores(iterResults, directory, labelsDictionary, cl
testSTDs = np.std(testScores, axis=1) testSTDs = np.std(testScores, axis=1)
nbResults = len(trainMeans) nbResults = len(trainMeans)
reversedClassifiersDict = dict((value, key) for key, value in classifiersDict.items()) reversedClassifiersDict = dict((value, key) for key, value in classifiersDict.items())
# import pdb;pdb.set_trace()
names = [reversedClassifiersDict[i] for i in range(len(classifiersDict))] names = [reversedClassifiersDict[i] for i in range(len(classifiersDict))]
size=nbResults size=nbResults
if nbResults<minSize: if nbResults<minSize:
......
...@@ -53,11 +53,11 @@ def makeMeNoisy(viewData, randomState, percentage=15): ...@@ -53,11 +53,11 @@ def makeMeNoisy(viewData, randomState, percentage=15):
def getPlausibleDBhdf5(features, pathF, name, NB_CLASS=3, LABELS_NAME="", randomState=None, full=True, nbView=3, def getPlausibleDBhdf5(features, pathF, name, NB_CLASS=3, LABELS_NAME="", randomState=None, full=True, nbView=3,
nbClass=2, datasetLength=347, randomStateInt=None): nbClass=2, datasetLength=34, randomStateInt=None):
"""Used to generate a plausible dataset to test the algorithms""" """Used to generate a plausible dataset to test the algorithms"""
randomStateInt = 42 randomStateInt = 42
randomState = np.random.RandomState(randomStateInt) randomState = np.random.RandomState(randomStateInt)
nbFeatures = 100 nbFeatures = 10
if not os.path.exists(os.path.dirname(pathF + "Plausible.hdf5")): if not os.path.exists(os.path.dirname(pathF + "Plausible.hdf5")):
try: try:
os.makedirs(os.path.dirname(pathF + "Plausible.hdf5")) os.makedirs(os.path.dirname(pathF + "Plausible.hdf5"))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment