| 58 | } |
| 59 | |
| 60 | void SavePoolToFile(TBinarizedPool& pool, const char* filename) { |
| 61 | TOFStream output(filename); |
| 62 | for (ui32 doc = 0; doc < pool.NumSamples; ++doc) { |
| 63 | TStringStream qid; |
| 64 | qid << pool.Qids[doc]; |
| 65 | output << qid.Str() << "\t" << pool.Targets[doc] << "\tFakeUrl"; |
| 66 | pool.Qids[doc] = CalcGroupIdFor(qid.Str()); |
| 67 | for (ui32 f = 0; f < pool.NumCatFeatures; ++f) { |
| 68 | output << "\t" << pool.CatFeatures[f][doc]; |
| 69 | } |
| 70 | for (ui32 f = 0; f < pool.NumFeatures; ++f) { |
| 71 | output << "\t" << (float)(pool.Features[f][doc]); |
| 72 | } |
| 73 | output << Endl; |
| 74 | } |
| 75 | } |
| 76 | |
| 77 | void GenerateTestPool(TUnitTestPool& pool, ui32 numFeatures) { |
| 78 | TRandom rand(0); |
no test coverage detected