Commit efc03adc authored by Antoine PIGEAU's avatar Antoine PIGEAU
Browse files

update NamedTuple not finished

parent 06a20221
......@@ -451,18 +451,18 @@ class ScriptClassifier:
for t in self.classifier.whereToCuts:
accuracies, accuracysPerClass, aucScores, stdAccuracy, stdAuc, dictResultPerCourse = self.predictionTaskForAllCourses(t, ntime)
resultAllCourses = self.predictionTaskForAllCourses(t, ntime)
dictResult[t] = dictResultPerCourse
dictResult[t] = resultAllCourses
for i, idCourse in enumerate(self.classifier.getIdCourses()): #
# for i, idCourse in enumerate(self.classifier.getIdCourses()): #
scoresCourse = dictResultPerCourse.get(idCourse, [])
# scoresCourse = dictResultPerCourse.get(idCourse, [])
#if not scoresCourse:
# dictResult[idCourse] = scoresCourse
scoresCourse.append((accuracies[i], accuracysPerClass[i], aucScores[i]))
# scoresCourse.append((accuracies[i], accuracysPerClass[i], aucScores[i]))
fileNameSavedResult = os.path.join(self.directoryExperiment,
self.fileName+
......@@ -480,7 +480,7 @@ class ScriptClassifier:
self.classifier.getFeatures(),
self.classifier.getWhereToCuts,
self.classifier.getWhereToCutUnity(),
groups, stdAccuracy, stdAuc), fileResult)
groups), fileResult)
fileNameResultAccuracy = os.path.join(self.directoryExperiment,
"Latex"+
......
......@@ -28,7 +28,15 @@ from model.course import Course
def exportResultAccuracy(fileName, dictResult, courses):
'''
@param dictResult: dictResult[t][idCourse] for the keys
@param dictResult: dictResult[t][resultAllCourses]
resultAllCourses = ResultAllCourses(scoreFinal, stdAccuracy,
aucScoreFinal, stdAuc,
avgConfusionMatrix.diagonal(), dictResultAllCourses)
dictResultAllCourses[id] = ResultCourse(accuracies, aucScores, avgConfusionMatrix, dictWeight)
[idCourse] = (accuracysCourse, aucScoresCourse, confusionMatrix, dictWeight)
a dictionary where key are the course id and values are defined as :
......@@ -51,10 +59,21 @@ def exportResultAccuracy(fileName, dictResult, courses):
print(key)
for course in courses:
scoresCourse = dictResult.get(course.getCourseId(), [])
scoresCourse = []
name = course.getName()
idCourse = course.getCourseId()
for period in dictResult.keys():
resultCourse = dictResult[period].dictResultAllCourses[idCourse]
accuracy = np.mean(resultCourse.accuracies)
(valueS, valueF) = resultCourse.avgConfusionMatrix.diagonal()
scoresCourse.append((accuracy, (valueS, valueF)))
fileResult.write(name+"\t\t\t\t\t && ")
for period, (accuracy, (valueS, valueF), _) in enumerate(scoresCourse):
if period in [0, 1, 2, 3]:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment