Skip to content
Snippets Groups Projects
Commit 15d28e55 authored by bbauvin's avatar bbauvin
Browse files

Modified Monoview result savig to save the labels and still be understandable

parent f4370630
No related branches found
No related tags found
No related merge requests found
...@@ -432,7 +432,7 @@ trainIndices, testIndices, a, aa = sklearn.model_selection.train_test_split(indi ...@@ -432,7 +432,7 @@ trainIndices, testIndices, a, aa = sklearn.model_selection.train_test_split(indi
random_state=randomState) random_state=randomState)
classificationIndices = (trainIndices, testIndices) classificationIndices = (trainIndices, testIndices)
kFolds = sklearn.model_selection.KFold(n_splits=args.CL_nbFolds, random_state=randomState) kFolds = sklearn.model_selection.KFold(n_splits=args.CL_nbFolds, random_state=randomState)
kFoldsIndices = kFolds.split(trainIndices) # kFoldsIndices = kFolds.split(trainIndices)
datasetFiles = initMultipleDatasets(args, nbCores) datasetFiles = initMultipleDatasets(args, nbCores)
......
...@@ -8,6 +8,7 @@ import datetime # for TimeStamp in CSVFile ...@@ -8,6 +8,7 @@ import datetime # for TimeStamp in CSVFile
import os # to geth path of the running script import os # to geth path of the running script
import time # for time calculations import time # for time calculations
import operator import operator
import errno
# Import 3rd party modules # Import 3rd party modules
import numpy as np # for reading CSV-files and Series import numpy as np # for reading CSV-files and Series
...@@ -121,12 +122,21 @@ def ExecMonoview(directory, X, Y, name, labelsNames, classificationIndices, KFol ...@@ -121,12 +122,21 @@ def ExecMonoview(directory, X, Y, name, labelsNames, classificationIndices, KFol
labelsString = "-".join(labelsNames) labelsString = "-".join(labelsNames)
timestr = time.strftime("%Y%m%d-%H%M%S") timestr = time.strftime("%Y%m%d-%H%M%S")
CL_type_string = CL_type CL_type_string = CL_type
outputFileName = directory + timestr + "Results-" + CL_type_string + "-" + labelsString + \ outputFileName = directory + "/"+CL_type_string+"/"+"/"+feat+"/"+timestr +"Results-" + CL_type_string + "-" + labelsString + \
'-learnRate' + str(len(classificationIndices)) + '-' + name + "-" + feat '-learnRate' + str(len(classificationIndices)) + '-' + name + "-" + feat + "-"
if not os.path.exists(os.path.dirname(outputFileName)):
try:
os.makedirs(os.path.dirname(outputFileName))
except OSError as exc:
if exc.errno != errno.EEXIST:
raise
outputTextFile = open(outputFileName + '.txt', 'w') outputTextFile = open(outputFileName + '.txt', 'w')
outputTextFile.write(stringAnalysis) outputTextFile.write(stringAnalysis)
outputTextFile.close() outputTextFile.close()
np.savetxt(outputFileName+"full_pred.csv", full_labels.astype(np.int16), delimiter=",")
np.savetxt(outputFileName+"train_pred.csv", y_train_pred.astype(np.int16), delimiter=",")
np.savetxt(outputFileName+"test_pred.csv", y_test_pred.astype(np.int16), delimiter=",")
if imagesAnalysis is not None: if imagesAnalysis is not None:
for imageName in imagesAnalysis: for imageName in imagesAnalysis:
...@@ -141,7 +151,7 @@ def ExecMonoview(directory, X, Y, name, labelsNames, classificationIndices, KFol ...@@ -141,7 +151,7 @@ def ExecMonoview(directory, X, Y, name, labelsNames, classificationIndices, KFol
logging.info("Done:\t Result Analysis") logging.info("Done:\t Result Analysis")
viewIndex = args["viewIndex"] viewIndex = args["viewIndex"]
return viewIndex, [CL_type, cl_desc+[feat], metricsScores, full_labels] return viewIndex, [CL_type, cl_desc+[feat], metricsScores, full_labels, y_train_pred]
# # Classification Report with Precision, Recall, F1 , Support # # Classification Report with Precision, Recall, F1 , Support
# logging.debug("Info:\t Classification report:") # logging.debug("Info:\t Classification report:")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment