You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
def _compute_statistics(self, num_cases: int, predictionTargetWindow: np.ndarray, correlation_per_window: np.ndarray, target):
self.bestDic = {index: correlation_per_window[index] for index in self.best_windows_index}
self.worstDic = {index: correlation_per_window[index] for index in self.worst_windows_index}
self.bestSorted = sorted(self.bestDic.items(), reverse=True, key=lambda x: x[1])
self.worstSorted = sorted(self.worstDic.items(), key=lambda x: x[1])
# TODO Probablemente solamente guardar bestSorted y tratarlo con el nombre de bestDic o best_windows, además de solo contemplar hasta num_cases
self.bestSorted = self.bestSorted[0:num_cases]
self.worstSorted = self.worstSorted[0:num_cases]
print("Calculando MAE para cada ventana")
for tupla in self.bestSorted:
self.bestMAE.append(
mean_absolute_error(target[tupla[0]], predictionTargetWindow.reshape(-1, 1)))
for tupla in self.worstSorted:
self.worstMAE.append(
mean_absolute_error(target[tupla[0]], predictionTargetWindow.reshape(-1, 1)))
print("Generando reporte de análisis")
# Version with method name as column name
# d = {'Index': dict(self.bestSorted).keys(), self.method: dict(self.bestSorted).values(), "Best MAE": self.bestMAE,
# 'Index': dict(self.worstSorted).keys(), self.method: dict(self.worstSorted).values(),
# "Worst MAE": self.worstMAE}
# Version 1.0 when CCI was the only one method defined
# TODO Atender impresión de nombre de acuerdo su tipo (String o Callable)
# TODO Verificar correcto funcionamiento de creación del objeto Dataframe
d = {'index': dict(self.bestSorted).keys(), self.method: dict(self.bestSorted).values(), "MAE": self.bestMAE}
# The worst indices were disabled in order to remove the duplicated keys such as index.1 and so forth
# 'index.1': dict(self.worstSorted).keys(), 'other': dict(self.worstSorted).values(),
# "MAE.1": self.worstMAE
self.analysisReport = pd.DataFrame(data=d)
The text was updated successfully, but these errors were encountered:
The text was updated successfully, but these errors were encountered: