我正在尝试运行一个 gfor 循环,但这只运行一次......
有人可以帮助我吗?
gfor(seq j, gammaStep-1){
vector<predicao> vals;
countLoop = (int) sqc(j).scalar<float>();
double localGamma = (countLoop+1)*incGamma;
vector<rbf> rbfs = mountRbf(X1, Y1, localGamma);
for (int i = 0; i < XT.size(); i++){
double p = prediction(XT[i], rbfs, localGamma);
predicao p1;
p1.val = p;
p1.err = abs(XT[i] - p);
vals.push_back(p1);
}
double sumErr = 0;
for (int i = 0; i < vals.size(); i++){
sumErr += vals[i].err;
}
double media = sumErr / vals.size();
double vary = 0;
for (int i = 0; i < vals.size(); i++){
vary += pow(vals[i].err - media, 2);
}
double dev = sqrt(vary);
eM[countLoop] = media;
eD[countLoop] = dev;
}
在处理结束时,只计算了 eM 和 eD 的第一个位置......