36 lines
876 B
C++
36 lines
876 B
C++
#include "StdAfx.h"
|
|
#include <iostream>
|
|
#include "SMape.h"
|
|
#include "Math.h"
|
|
#include <vector>
|
|
|
|
// êðèòåðèé SMape. Íàñëåäóåòñÿ îò êëàññà Estimation.
|
|
// ðåàëèçóåò ìåòîä "ïîëó÷èòü çíà÷åíèå êðèòåðèÿ"
|
|
|
|
SMape::SMape() {
|
|
|
|
}
|
|
|
|
SMape::~SMape() {
|
|
}
|
|
|
|
double SMape::getValue(int countParams, vector<double> original, vector<double> model) {
|
|
return 0;
|
|
}
|
|
|
|
double SMape::getValue(vector<double> original, vector<double> model) {
|
|
double smape = 0;
|
|
for (int i = 0; i < original.size(); i++) {
|
|
/*double a = original[i] - model[i];
|
|
double b = (original[i] + model[i]) / 2;
|
|
double c = fabs(a);
|
|
double d = fabs(b);*/
|
|
smape += (fabs((double)original[i] - model[i])) /
|
|
(((fabs((double)(original[i])) + fabs((double)model[i]))) / 2);
|
|
}
|
|
smape = smape / original.size();
|
|
smape = smape * 100;
|
|
|
|
return smape;
|
|
}
|