int main(void) { es2(); return 0; }
int main() { int n=10; int a[n]; int ris=es2(a,n); }
double FC_cv::compute_energyscore(void) { unsigned s,i,j; unsigned S = sampled_responses.cols(); unsigned I = sampled_responses.rows(); //double * srp = sampled_responses.getV(); // double * esp1; // double * esp2; datamatrix es1 = datamatrix(nrcat,S,0); datamatrix es2 = datamatrix(nrcat,S,0); /* for (i=0;i<I;i++) { esp1 = es1.getV()+ind(i,0)*S; esp2 = es2.getV()+ind(i,0)*S; for (s=0;s<S-1;s++,srp++,esp1++,esp2++) { *esp1 += pow(sampled_responses(i,s)-likep->response_untransformed(i,0),2); *esp2 += pow(sampled_responses(i,s+1)-sampled_responses(i,s),2); } esp1++; *esp1 += pow(sampled_responses(i,s)-likep->response_untransformed(i,0),2); } */ unsigned in; for (i=0;i<I;i++) { in = ind(i,0); for (s=0;s<S-1;s++) { es1(in,s) += pow(sampled_responses(i,s)-likep->response(i,0),2); es2(in,s) += pow(sampled_responses(i,s+1)-sampled_responses(i,s),2); } es1(in,S-1) += pow(sampled_responses(i,s)-likep->response(i,0),2); } // ofstream out("c:\\bayesx\\testh\\results\\es1.res"); // es1.prettyPrint(out); if (e_score.rows() != nrcat) e_score = datamatrix(nrcat,1,0); double h; for (j=0;j<nrcat;j++) { for (s=0;s<S;s++) e_score(j,0) += sqrt(es1(j,s)); e_score(j,0) /= S; h=0; for(s=0;s<S-1;s++) h += sqrt(es2(j,s)); e_score(j,0) -= h/(2*(S-1)); } return e_score.mean(0); }