Definition at line 68 of file ParameterSearcher.h. References Impala::Util::PropertySet::GetDescription(), Impala::Util::PropertySet::GetInt(), Impala::Util::RangeIterator::GetParameters(), Impala::Util::RangeIterator::GetTotalIterations(), mBestScore, mIterator, mParallelMode, mProperties, mScores, SearchParallel(), SearchSequential(), and Impala::Util::RangeIterator::SetIteration(). Referenced by Impala::Application::CrossValidate(). 00069 { 00070 int r = mProperties.GetInt("repetitions"); 00071 int f = mProperties.GetInt("folds"); 00072 mScores.assign(mIterator.GetTotalIterations() * f * r, 0); 00073 mBestScore = 0; 00074 // first try all parameter settings evaluation is stored in mScores 00075 if(mParallelMode) 00076 SearchParallel(); 00077 else 00078 SearchSequential(); 00079 00080 // average the scores 00081 std::vector<double> scores; 00082 int iters = mIterator.GetTotalIterations(); 00083 scores.assign(iters, 0); 00084 int i; 00085 for(i=0 ; i<mScores.size() ; ++i) 00086 { 00087 scores[i%iters] += mScores[i]; 00088 } 00089 double d = f*r; 00090 for(i=0 ; i<scores.size() ; ++i) 00091 { 00092 scores[i] /= d; 00093 } 00094 00095 // select the wining setting 00096 std::vector<double>::iterator best = 00097 std::max_element(scores.begin(), scores.end()); 00098 int bestIteration = best - scores.begin(); 00099 mIterator.SetIteration(bestIteration); 00100 mIterator.GetParameters(&mProperties); 00101 mBestScore = *best; 00102 ILOG_INFO_ONCE("best score = " << mBestScore << 00103 " @ params: " << mProperties.GetDescription()); 00104 return mProperties; 00105 }
Here is the call graph for this function:
|