From 2dc84c2863362adef6f6d08b2f7e890811423334 Mon Sep 17 00:00:00 2001 From: marcin-szczepanski Date: Fri, 5 Jun 2020 17:27:56 +0200 Subject: [PATCH] Update statystyk --- Front/src/app/app.component.html | 80 +++++++++++++++++++++++++++++--- Front/src/app/app.component.ts | 32 +++++++++++++ 2 files changed, 106 insertions(+), 6 deletions(-) diff --git a/Front/src/app/app.component.html b/Front/src/app/app.component.html index d5f4715..8696343 100644 --- a/Front/src/app/app.component.html +++ b/Front/src/app/app.component.html @@ -100,6 +100,73 @@

Procent trafionych predykcji wyniku meczu: {{ ((TP / matches.length) * 100).toFixed(2) }}%


+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Kategoria + + Dokładność (accuracy) + + Czułość (recall) + + Precyzja (precision) + + Swoistość (specifity) + + F-measure +
+ Micro Average + + {{accuracyMicro.toFixed(3)}} + + {{recallMicro.toFixed(3)}} + + {{precisionMicro.toFixed(3)}} + + {{specificityMicro.toFixed(3)}} + + {{fMeasureMicro.toFixed(3)}} +
+ Macro Average + + {{accuracyMacro.toFixed(3)}} + + {{recallMacro.toFixed(3)}} + + {{precisionMacro.toFixed(3)}} + + {{specificityMacro.toFixed(3)}} + + {{fMeasureMacro.toFixed(3)}} +
+

@@ -143,9 +210,9 @@ - @@ -181,9 +248,9 @@ - @@ -219,9 +286,9 @@ - @@ -258,6 +325,7 @@
+ Wygrana drużyny - + {{pW}}
+ Remis - + {{pD}}
+ Przegrana drużyny - + {{pL}}
+



diff --git a/Front/src/app/app.component.ts b/Front/src/app/app.component.ts index 7557333..463c44e 100644 --- a/Front/src/app/app.component.ts +++ b/Front/src/app/app.component.ts @@ -60,6 +60,18 @@ export class AppComponent implements OnInit { FP = 0; FN = 0; + accuracyMacro = 0; + precisionMacro = 0; + recallMacro = 0; + specificityMacro = 0; + fMeasureMacro = 0; + + accuracyMicro = 0; + precisionMicro = 0; + recallMicro = 0; + specificityMicro = 0; + fMeasureMicro = 0; + @ViewChild('dt') table: Table; constructor(private apiHelper: ApiHelper, @@ -119,6 +131,8 @@ export class AppComponent implements OnInit { this.countStatisticsForWin(); this.countStatisticsForDraw(); this.countStatisticsForLoss(); + this.countMicro(); + this.countMacro(); } countTPFPFN() { @@ -262,4 +276,22 @@ export class AppComponent implements OnInit { countFMeasure(precision, recall) { return (2 * precision * recall) / (precision + recall); } + + countMacro() { + this.accuracyMacro = (this.accuracyD + this.accuracyL + this.accuracyW) / 3; + this.precisionMacro = (this.precisionD + this.precisionL + this.precisionW) / 3; + this.recallMacro = (this.recallD + this.recallL + this.recallW) / 3; + this.specificityMacro = (this.specificityD + this.specificityL + this.specificityW) / 3; + this.fMeasureMacro = (this.fMeasureD + this.fMeasureL + this.fMeasureW) / 3; + } + + countMicro() { + // tslint:disable-next-line:max-line-length + this.accuracyMicro = (this.tpD + this.tpL + this.tpW + this.tnD + this.tnL + this.tnW) / (this.pD + this.pW + this.pL + this.nD + this.nL + this.nW); + this.precisionMicro = (this.tpD + this.tpL + this.tpW) / (this.tpD + this.tpL + this.tpW + this.fpD + this.fpL + this.fpW); + this.recallMicro = (this.tpD + this.tpL + this.tpW) / (this.tpD + this.tpL + this.tpW + this.fnD + this.fnL + this.fnW); + this.specificityMicro = (this.tnD + this.tnL + this.tnW) / (this.fpD + this.fpL + this.fpW + this.tnD + this.tnL + this.tnW); + // tslint:disable-next-line:max-line-length + this.fMeasureMicro = ((2 * this.precisionD * this.recallD) + (2 * this.precisionL * this.recallL) + (2 * this.precisionW * this.recallW)) / (this.precisionD + this.precisionL + this.precisionW + this.recallD + this.recallL + this.recallW); + } }