Definition at line 62 of file TrecSVM.h. References mDataFile, mFeatList, and mFirstTime. Referenced by UpdateAnno(). 00063 { 00064 FILE *fp; 00065 std::string wMode = (mFirstTime) ? "w" : "a"; 00066 mFirstTime = false; 00067 if ((fp = fopen(mDataFile.c_str(), wMode.c_str())) == 0) 00068 { 00069 std::cout << "TrecSVM::WriteResults : Unable to write to " 00070 << mDataFile << std::endl; 00071 return; 00072 } 00073 00074 int maxSamples = 250; 00075 int width = mFeatList[0]->CW(); 00076 int height = mFeatList[0]->CH(); 00077 int skip = width * height / maxSamples; 00078 int s = skip; 00079 for (int y=0 ; y<height ; y++) 00080 { 00081 for (int x=0 ; x<width ; x++) 00082 { 00083 if (--s <= 0) 00084 { 00085 fprintf(fp, "%d", con); 00086 for (int f=0 ; f<mFeatList.size() ; f++) 00087 { 00088 Real64 val = *(mFeatList[f]->CPB(x, y)); 00089 fprintf(fp, " %d:%f", f+1, val); 00090 } 00091 fprintf(fp, "\n"); 00092 s = skip; 00093 } 00094 } 00095 } 00096 fclose(fp); 00097 }
|