Advertisement
Guest User

Untitled

a guest
Feb 19th, 2012
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.04 KB | None | 0 0
  1. void doSomething(const std::vector<int> & randFeatures, const std::vector<int>& inBagSamples, const matrix<float>& data ){
  2.  
  3.         std::vector<std::pair<float, int> > responses;
  4.  
  5.         std::vector<int>::const_iterator it(randFeatures.begin());
  6.         std::vector<int>::const_iterator end(randFeatures.end());
  7.  
  8.         std::vector<int>::const_iterator bagIt;
  9.         std::vector<int>::const_iterator bagEnd(inBagSamples.end());
  10.        
  11.         float fmaxRes  = FLT_MIN, fminRes  = FLT_MAX;
  12.         float treshdiff = 0.0;
  13.         float curThreshold = 0.0;
  14.         while ( it != end )
  15.         {
  16.             responses.clear();
  17.             responses.reserve(inBagSamples.size());
  18.             bagIt = inBagSamples.begin();
  19.             while ( bagIt != bagEnd )
  20.             {
  21.                 responses.push_back(std::pair<float, int>(data(*bagIt,*it),*bagIt));
  22.                 ++bagIt;
  23.             }
  24.             sort(responses.begin(), responses.end());
  25.             fminRes = responses.front().first;
  26.             fmaxRes = responses.back().first;
  27.            
  28.             treshdiff = fmaxRes - fminRes;
  29.            
  30.             if( treshdiff > 0 ){
  31.  
  32.                 curThreshold      = randomDouble(treshmin, treshmax);
  33.                 //.......
  34.             }
  35.  
  36.         }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement