1
Fork 0
mirror of https://github.com/Steffo99/unimore-bda-6.git synced 2024-11-21 23:44:19 +00:00

Properly accumulate errors in EvaluationResults

This commit is contained in:
Steffo 2023-04-14 01:47:59 +02:00
parent dc08a6ce0f
commit 18b367db6f
Signed by: steffo
GPG key ID: 2A24051445686895

View file

@ -81,6 +81,8 @@ class EvaluationResults:
def __add__(self, other: EvaluationResults) -> EvaluationResults: def __add__(self, other: EvaluationResults) -> EvaluationResults:
new = self.__class__() new = self.__class__()
new.absolute_error_total = self.absolute_error_total + other.absolute_error_total
new.squared_error_total = self.squared_error_total + other.squared_error_total
for expected, value in self.confusion_matrix.items(): for expected, value in self.confusion_matrix.items():
for predicted, amount in value.items(): for predicted, amount in value.items():
new.confusion_matrix[expected][predicted] += amount new.confusion_matrix[expected][predicted] += amount