Statystyki dla goli

This commit is contained in:
marcin-szczepanski 2020-06-08 23:10:16 +02:00
parent 4166a22f3f
commit a593689b9c
3 changed files with 41 additions and 1 deletions

View File

@ -325,6 +325,10 @@
</tr>
</tbody>
</table>
<br /><br />
<p style="margin-bottom: 0.25rem;">Procent trafionych predykcji goli: {{ ((TP_goals / matches.length) * 100).toFixed(2) }}%</p>
<p style="margin-bottom: 0.25rem;"><b>RMSE</b>: {{rmse.toFixed(3)}}</p>
<p><b>MAE</b>: {{mae.toFixed(3)}}</p>
<br /><br /><br /><br />
</div>
</main>

View File

@ -72,6 +72,11 @@ export class AppComponent implements OnInit {
specificityMicro = 0;
fMeasureMicro = 0;
// tslint:disable-next-line:variable-name
TP_goals = 0;
rmse = 0;
mae = 0;
@ViewChild('dt') table: Table;
constructor(private apiHelper: ApiHelper,
@ -133,6 +138,7 @@ export class AppComponent implements OnInit {
this.countStatisticsForLoss();
this.countMicro();
this.countMacro();
this.countGoalsStatistics();
}
countTPFPFN() {
@ -294,4 +300,34 @@ export class AppComponent implements OnInit {
// 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);
}
countGoalsStatistics() {
this.countTPGoals();
this.countRMSE();
this.countMAE();
}
countTPGoals() {
this.matches.forEach(x => {
if (x.goals == x.predictedGoals) {
this.TP_goals += 1;
}
});
}
countRMSE() {
let sum = 0;
this.matches.forEach(x => {
sum += Math.pow((x.goals - x.predictedGoals), 2);
});
this.rmse = Math.sqrt(sum / this.matches.length);
}
countMAE() {
let sum = 0;
this.matches.forEach(x => {
sum += Math.abs(x.goals - x.predictedGoals);
});
this.mae = Math.sqrt(sum / this.matches.length);
}
}

View File

@ -3,7 +3,7 @@ export class PredictedMatch {
public id: number;
public result?: string;
public predictedResult?: string;
public predictedGoals?: string;
public predictedGoals?: number;
public goals?: number;
public season?: string;
public date?: string;