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

Replaced : with _in names

parent 346cbaca
Branches
Tags
No related merge requests found
...@@ -594,7 +594,7 @@ def execClassif(arguments): ...@@ -594,7 +594,7 @@ def execClassif(arguments):
# m, s = divmod(totalDur, 60) # m, s = divmod(totalDur, 60)
# h, m = divmod(m, 60) # h, m = divmod(m, 60)
# d, h = divmod(h, 24) # d, h = divmod(h, 24)
# # print "%d:%02d:%02d" % (h, m, s) # # print "%d_%02d_%02d" % (h, m, s)
# logging.info("Info:\t Total duration : " + str(d) + " days, " + str(h) + " hours, " + str(m) + " mins, " + str( # logging.info("Info:\t Total duration : " + str(d) + " days, " + str(h) + " hours, " + str(m) + " mins, " + str(
# int(s)) + "secs.") # int(s)) + "secs.")
# #
...@@ -618,7 +618,7 @@ def execClassif(arguments): ...@@ -618,7 +618,7 @@ def execClassif(arguments):
# m, s = divmod(totalDur, 60) # m, s = divmod(totalDur, 60)
# h, m = divmod(m, 60) # h, m = divmod(m, 60)
# d, h = divmod(h, 24) # d, h = divmod(h, 24)
# # print "%d:%02d:%02d" % (h, m, s) # # print "%d_%02d_%02d" % (h, m, s)
# logging.info("Info:\t Total duration : "+str(d)+ " days, "+str(h)+" hours, "+str(m)+" mins, "+str(int(s))+"secs.") # logging.info("Info:\t Total duration : "+str(d)+ " days, "+str(h)+" hours, "+str(m)+" mins, "+str(int(s))+"secs.")
# #
# if statsIter > 1: # if statsIter > 1:
......
...@@ -126,7 +126,7 @@ def initConstants(args, X, classificationIndices, labelsNames, name, directory): ...@@ -126,7 +126,7 @@ def initConstants(args, X, classificationIndices, labelsNames, name, directory):
learningRate = float(len(classificationIndices[0])) / (len(classificationIndices[0]) + len(classificationIndices[1])) learningRate = float(len(classificationIndices[0])) / (len(classificationIndices[0]) + len(classificationIndices[1]))
labelsString = "-".join(labelsNames) labelsString = "-".join(labelsNames)
CL_type_string = CL_type CL_type_string = CL_type
timestr = time.strftime("%Y_%m_%d-%H:%M:%S") timestr = time.strftime("%Y_%m_%d-%H_%M_%S")
outputFileName = directory + CL_type_string + "/" + feat + "/" + timestr + "-Results-" + CL_type_string + "-" + labelsString + \ outputFileName = directory + CL_type_string + "/" + feat + "/" + timestr + "-Results-" + CL_type_string + "-" + labelsString + \
'-learnRate_{0:.2f}'.format(learningRate) + '-' + name + "-" + feat + "-" '-learnRate_{0:.2f}'.format(learningRate) + '-' + name + "-" + feat + "-"
if not os.path.exists(os.path.dirname(outputFileName)): if not os.path.exists(os.path.dirname(outputFileName)):
...@@ -268,7 +268,7 @@ if __name__ == '__main__': ...@@ -268,7 +268,7 @@ if __name__ == '__main__':
X, Y = Dataset.getMonoviewShared(path, name, viewName) X, Y = Dataset.getMonoviewShared(path, name, viewName)
# Init log # Init log
logFileName = time.strftime("%Y_%m_%d-%H:%M:%S") + "-" + name + "-"+ viewName +"-" + classifierName +'-LOG' logFileName = time.strftime("%Y_%m_%d-%H_%M_%S") + "-" + name + "-"+ viewName +"-" + classifierName +'-LOG'
if not os.path.exists(os.path.dirname(directory + logFileName)): if not os.path.exists(os.path.dirname(directory + logFileName)):
try: try:
os.makedirs(os.path.dirname(directory + logFileName)) os.makedirs(os.path.dirname(directory + logFileName))
......
...@@ -42,7 +42,7 @@ def saveResults(LABELS_DICTIONARY, stringAnalysis, views, classifierModule, clas ...@@ -42,7 +42,7 @@ def saveResults(LABELS_DICTIONARY, stringAnalysis, views, classifierModule, clas
logging.info(stringAnalysis) logging.info(stringAnalysis)
viewsString = "-".join(views) viewsString = "-".join(views)
labelsString = "-".join(labelsSet) labelsString = "-".join(labelsSet)
timestr = time.strftime("%Y_%m_%d-%H:%M:%S") timestr = time.strftime("%Y_%m_%d-%H_%M_%S")
CL_type_string = classifierModule.genName(classificationKWARGS) CL_type_string = classifierModule.genName(classificationKWARGS)
outputFileName = directory + "/" + CL_type_string + "/" + timestr + "-Results-" + CL_type_string + "-" + viewsString + '-' + labelsString + \ outputFileName = directory + "/" + CL_type_string + "/" + timestr + "-Results-" + CL_type_string + "-" + viewsString + '-' + labelsString + \
'-learnRate_{0:.2f}'.format(learningRate) + '-' + name '-learnRate_{0:.2f}'.format(learningRate) + '-' + name
......
...@@ -126,7 +126,7 @@ def publishMetricsGraphs(metricsScores, directory, databaseName, labelsNames): ...@@ -126,7 +126,7 @@ def publishMetricsGraphs(metricsScores, directory, databaseName, labelsNames):
testScores = metricScores["testScores"] testScores = metricScores["testScores"]
names = metricScores["classifiersNames"] names = metricScores["classifiersNames"]
nbResults = len(testScores) nbResults = len(testScores)
fileName = directory + time.strftime("%Y_%m_%d-%H:%M:%S") + "-" + databaseName +"-"+"_vs_".join(labelsNames)+ "-" + metricName + ".png" fileName = directory + time.strftime("%Y_%m_%d-%H_%M_%S") + "-" + databaseName +"-"+"_vs_".join(labelsNames)+ "-" + metricName + ".png"
plotMetricOneIter(trainScores, testScores, names, nbResults, metricName, fileName) plotMetricOneIter(trainScores, testScores, names, nbResults, metricName, fileName)
logging.debug("Done:\t Biclass score graph generation for " + metricName) logging.debug("Done:\t Biclass score graph generation for " + metricName)
...@@ -167,7 +167,7 @@ def publishExampleErrors(exampleErrors, directory, databaseName, labelsNames, mi ...@@ -167,7 +167,7 @@ def publishExampleErrors(exampleErrors, directory, databaseName, labelsNames, mi
borderaxespad=0, borderaxespad=0,
ncol=3) ncol=3)
fig.tight_layout() fig.tight_layout()
fig.savefig(directory + time.strftime("%Y_%m_%d-%H:%M:%S") + "-" + databaseName +"-"+"_vs_".join(labelsNames)+ "-error_analysis.png", bbox_inches="tight") fig.savefig(directory + time.strftime("%Y_%m_%d-%H_%M_%S") + "-" + databaseName +"-"+"_vs_".join(labelsNames)+ "-error_analysis.png", bbox_inches="tight")
plt.close() plt.close()
logging.debug("Done:\t Biclass Label analysis figure generation") logging.debug("Done:\t Biclass Label analysis figure generation")
...@@ -180,7 +180,7 @@ def publishExampleErrors(exampleErrors, directory, databaseName, labelsNames, mi ...@@ -180,7 +180,7 @@ def publishExampleErrors(exampleErrors, directory, databaseName, labelsNames, mi
plt.bar(x, errorOnExamples) plt.bar(x, errorOnExamples)
plt.ylim([0,nbClassifiers]) plt.ylim([0,nbClassifiers])
plt.title("Number of classifiers that failed to classify each example") plt.title("Number of classifiers that failed to classify each example")
fig.savefig(directory + time.strftime("%Y_%m_%d-%H:%M:%S") + "-" + databaseName +"-"+"_vs_".join(labelsNames)+ "-example_errors.png") fig.savefig(directory + time.strftime("%Y_%m_%d-%H_%M_%S") + "-" + databaseName +"-"+"_vs_".join(labelsNames)+ "-example_errors.png")
plt.close() plt.close()
logging.debug("Done:\t Biclass Error by example figure generation") logging.debug("Done:\t Biclass Error by example figure generation")
...@@ -290,7 +290,7 @@ def publishMulticlassScores(multiclassResults, metrics, statsIter, direcories, d ...@@ -290,7 +290,7 @@ def publishMulticlassScores(multiclassResults, metrics, statsIter, direcories, d
ax.set_xticks(np.arange(nbResults) + barWidth) ax.set_xticks(np.arange(nbResults) + barWidth)
ax.set_xticklabels(names, rotation="vertical") ax.set_xticklabels(names, rotation="vertical")
plt.tight_layout() plt.tight_layout()
f.savefig(directory + time.strftime("%Y_%m_%d-%H:%M:%S") + "-" + databaseName + "-" + metric[0] + ".png") f.savefig(directory + time.strftime("%Y_%m_%d-%H_%M_%S") + "-" + databaseName + "-" + metric[0] + ".png")
plt.close() plt.close()
logging.debug("Done:\t Multiclass score graph generation for " + metric[0]) logging.debug("Done:\t Multiclass score graph generation for " + metric[0])
...@@ -326,20 +326,20 @@ def publishMulticlassExmapleErrors(multiclassResults, directories, databaseName, ...@@ -326,20 +326,20 @@ def publishMulticlassExmapleErrors(multiclassResults, directories, databaseName,
green_patch = mpatches.Patch(color='green', label='Classifier succeded') green_patch = mpatches.Patch(color='green', label='Classifier succeded')
plt.legend(handles=[red_patch, green_patch], bbox_to_anchor=(0,1.02,1,0.2), loc="lower left",mode="expand", borderaxespad=0, ncol=2) plt.legend(handles=[red_patch, green_patch], bbox_to_anchor=(0,1.02,1,0.2), loc="lower left",mode="expand", borderaxespad=0, ncol=2)
fig.tight_layout() fig.tight_layout()
fig.savefig(directory + time.strftime("%Y_%m_%d-%H:%M:%S") + "-" + databaseName +"-error_analysis.png", bbox_inches="tight") fig.savefig(directory + time.strftime("%Y_%m_%d-%H_%M_%S") + "-" + databaseName +"-error_analysis.png", bbox_inches="tight")
plt.close() plt.close()
logging.debug("Done:\t Label analysis figure generation") logging.debug("Done:\t Label analysis figure generation")
logging.debug("Start:\t Error by example figure generation") logging.debug("Start:\t Error by example figure generation")
errorOnExamples = -1*np.sum(data, axis=1)/nbIter+nbClassifiers errorOnExamples = -1*np.sum(data, axis=1)/nbIter+nbClassifiers
np.savetxt(directory + time.strftime("%Y_%m_%d-%H:%M:%S") + "-clf_errors_doubled.csv", data, delimiter=",") np.savetxt(directory + time.strftime("%Y_%m_%d-%H_%M_%S") + "-clf_errors_doubled.csv", data, delimiter=",")
np.savetxt(directory + time.strftime("%Y_%m_%d-%H:%M:%S") + "-example_errors.csv", temp_data, delimiter=",") np.savetxt(directory + time.strftime("%Y_%m_%d-%H_%M_%S") + "-example_errors.csv", temp_data, delimiter=",")
fig, ax = plt.subplots() fig, ax = plt.subplots()
x = np.arange(nbExamples) x = np.arange(nbExamples)
plt.bar(x, errorOnExamples) plt.bar(x, errorOnExamples)
plt.ylim([0,nbClassifiers]) plt.ylim([0,nbClassifiers])
plt.title("Number of classifiers that failed to classify each example") plt.title("Number of classifiers that failed to classify each example")
fig.savefig(directory + time.strftime("%Y_%m_%d-%H:%M:%S") + "-" + databaseName +"-example_errors.png") fig.savefig(directory + time.strftime("%Y_%m_%d-%H_%M_%S") + "-" + databaseName +"-example_errors.png")
plt.close() plt.close()
logging.debug("Done:\t Error by example figure generation") logging.debug("Done:\t Error by example figure generation")
...@@ -451,7 +451,7 @@ def publishIterBiclassMetricsScores(iterResults, directory, labelsDictionary, cl ...@@ -451,7 +451,7 @@ def publishIterBiclassMetricsScores(iterResults, directory, labelsDictionary, cl
ax.set_xticks(np.arange(nbResults) + barWidth) ax.set_xticks(np.arange(nbResults) + barWidth)
ax.set_xticklabels(names, rotation="vertical") ax.set_xticklabels(names, rotation="vertical")
f.tight_layout() f.tight_layout()
f.savefig(currentDirectory + time.strftime("%Y_%m_%d-%H:%M:%S") + "-" + dataBaseName + "-Mean_on_" f.savefig(currentDirectory + time.strftime("%Y_%m_%d-%H_%M_%S") + "-" + dataBaseName + "-Mean_on_"
+ str(statsIter) + "_iter-" + metricName + ".png") + str(statsIter) + "_iter-" + metricName + ".png")
plt.close() plt.close()
...@@ -491,7 +491,7 @@ def publishIterBiclassExampleErrors(iterResults, directory, labelsDictionary, cl ...@@ -491,7 +491,7 @@ def publishIterBiclassExampleErrors(iterResults, directory, labelsDictionary, cl
cbar = fig.colorbar(cax, ticks=[-100*statsIter/2, 0, statsIter]) cbar = fig.colorbar(cax, ticks=[-100*statsIter/2, 0, statsIter])
cbar.ax.set_yticklabels(['Unseen', 'Always Wrong', 'Always Right']) cbar.ax.set_yticklabels(['Unseen', 'Always Wrong', 'Always Right'])
fig.tight_layout() fig.tight_layout()
fig.savefig(currentDirectory + time.strftime("%Y_%m_%d-%H:%M:%S") + "-error_analysis.png") fig.savefig(currentDirectory + time.strftime("%Y_%m_%d-%H_%M_%S") + "-error_analysis.png")
plt.close() plt.close()
logging.debug("Done:\t Global label analysis figure generation") logging.debug("Done:\t Global label analysis figure generation")
...@@ -504,7 +504,7 @@ def publishIterBiclassExampleErrors(iterResults, directory, labelsDictionary, cl ...@@ -504,7 +504,7 @@ def publishIterBiclassExampleErrors(iterResults, directory, labelsDictionary, cl
plt.bar(x, errorOnExamples) plt.bar(x, errorOnExamples)
plt.ylim([0,nbClassifiers*statsIter]) plt.ylim([0,nbClassifiers*statsIter])
plt.title("Number of classifiers that failed to classify each example") plt.title("Number of classifiers that failed to classify each example")
fig.savefig(currentDirectory + time.strftime("%Y_%m_%d-%H:%M:%S") + "-example_errors.png") fig.savefig(currentDirectory + time.strftime("%Y_%m_%d-%H_%M_%S") + "-example_errors.png")
plt.close() plt.close()
logging.debug("Done:\t Global error by example figure generation") logging.debug("Done:\t Global error by example figure generation")
...@@ -542,7 +542,7 @@ def publishIterMulticlassMetricsScores(iterMulticlassResults, classifiersNames, ...@@ -542,7 +542,7 @@ def publishIterMulticlassMetricsScores(iterMulticlassResults, classifiersNames,
ax.set_xticks(np.arange(nbResults) + barWidth) ax.set_xticks(np.arange(nbResults) + barWidth)
ax.set_xticklabels(names, rotation="vertical") ax.set_xticklabels(names, rotation="vertical")
f.tight_layout() f.tight_layout()
f.savefig(directory + time.strftime("%Y_%m_%d-%H:%M:%S") + "-" + dataBaseName + "-Mean_on_" f.savefig(directory + time.strftime("%Y_%m_%d-%H_%M_%S") + "-" + dataBaseName + "-Mean_on_"
+ str(statsIter) + "_iter-" + metricName + ".png") + str(statsIter) + "_iter-" + metricName + ".png")
plt.close() plt.close()
...@@ -570,14 +570,14 @@ def publishIterMulticlassExampleErrors(iterMulticlassResults, directory, classif ...@@ -570,14 +570,14 @@ def publishIterMulticlassExampleErrors(iterMulticlassResults, directory, classif
logging.debug("Start:\t Global error by example figure generation") logging.debug("Start:\t Global error by example figure generation")
errorOnExamples = -1 * np.sum(data, axis=1) + (nbClassifiers*statsIter) errorOnExamples = -1 * np.sum(data, axis=1) + (nbClassifiers*statsIter)
np.savetxt(directory + time.strftime("%Y_%m_%d-%H:%M:%S") + "-clf_errors.csv", data, delimiter=",") np.savetxt(directory + time.strftime("%Y_%m_%d-%H_%M_%S") + "-clf_errors.csv", data, delimiter=",")
np.savetxt(directory + time.strftime("%Y_%m_%d-%H:%M:%S") + "-example_errors.csv", errorOnExamples, delimiter=",") np.savetxt(directory + time.strftime("%Y_%m_%d-%H_%M_%S") + "-example_errors.csv", errorOnExamples, delimiter=",")
fig, ax = plt.subplots() fig, ax = plt.subplots()
x = np.arange(nbExamples) x = np.arange(nbExamples)
plt.bar(x, errorOnExamples) plt.bar(x, errorOnExamples)
plt.ylim([0,nbClassifiers*statsIter]) plt.ylim([0,nbClassifiers*statsIter])
plt.title("Number of classifiers that failed to classify each example") plt.title("Number of classifiers that failed to classify each example")
fig.savefig(directory + time.strftime("%Y_%m_%d-%H:%M:%S") + "-example_errors.png") fig.savefig(directory + time.strftime("%Y_%m_%d-%H_%M_%S") + "-example_errors.png")
plt.close() plt.close()
logging.debug("Done:\t Global error by example figure generation") logging.debug("Done:\t Global error by example figure generation")
......
...@@ -239,7 +239,7 @@ def initRandomState(randomStateArg, directory): ...@@ -239,7 +239,7 @@ def initRandomState(randomStateArg, directory):
def initLogFile(args): def initLogFile(args):
"""Used to init the directory where the preds will be stored and the log file""" """Used to init the directory where the preds will be stored and the log file"""
resultDirectory = "../Results/" + args.name + "/started_" + time.strftime("%Y_%m_%d-%H_%M") + "/" resultDirectory = "../Results/" + args.name + "/started_" + time.strftime("%Y_%m_%d-%H_%M") + "/"
logFileName = time.strftime("%Y_%m_%d-%H:%M:%S") + "-" + ''.join(args.CL_type) + "-" + "_".join( logFileName = time.strftime("%Y_%m_%d-%H_%M_%S") + "-" + ''.join(args.CL_type) + "-" + "_".join(
args.views) + "-" + args.name + "-LOG" args.views) + "-" + args.name + "-LOG"
if not os.path.exists(os.path.dirname(resultDirectory + logFileName)): if not os.path.exists(os.path.dirname(resultDirectory + logFileName)):
try: try:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment