Update statystyk

This commit is contained in:
marcin-szczepanski 2020-06-05 17:27:56 +02:00
parent 1fe346bb09
commit 2dc84c2863
2 changed files with 106 additions and 6 deletions

View File

@ -100,6 +100,73 @@
<div>
<p>Procent trafionych predykcji wyniku meczu: {{ ((TP / matches.length) * 100).toFixed(2) }}%</p>
<br />
<table style="width: 50%">
<thead>
<tr>
<th>
Kategoria
</th>
<th>
Dokładność (accuracy)
</th>
<th>
Czułość (recall)
</th>
<th>
Precyzja (precision)
</th>
<th>
Swoistość (specifity)
</th>
<th>
F-measure
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
Micro Average
</td>
<td>
{{accuracyMicro.toFixed(3)}}
</td>
<td>
{{recallMicro.toFixed(3)}}
</td>
<td>
{{precisionMicro.toFixed(3)}}
</td>
<td>
{{specificityMicro.toFixed(3)}}
</td>
<td>
{{fMeasureMicro.toFixed(3)}}
</td>
</tr>
<tr>
<td>
Macro Average
</td>
<td>
{{accuracyMacro.toFixed(3)}}
</td>
<td>
{{recallMacro.toFixed(3)}}
</td>
<td>
{{precisionMacro.toFixed(3)}}
</td>
<td>
{{specificityMacro.toFixed(3)}}
</td>
<td>
{{fMeasureMacro.toFixed(3)}}
</td>
</tr>
</tbody>
</table>
<br /><br />
<table style="width: 90%">
<thead>
<tr>
@ -143,9 +210,9 @@
</thead>
<tbody>
<tr>
<th>
<td>
Wygrana drużyny
</th>
</td>
<td>
{{pW}}
</td>
@ -181,9 +248,9 @@
</td>
</tr>
<tr>
<th>
<td>
Remis
</th>
</td>
<td>
{{pD}}
</td>
@ -219,9 +286,9 @@
</td>
</tr>
<tr>
<th>
<td>
Przegrana drużyny
</th>
</td>
<td>
{{pL}}
</td>
@ -258,6 +325,7 @@
</tr>
</tbody>
</table>
<br /><br /><br /><br />
</div>
</main>
</div>

View File

@ -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);
}
}