// virtual void GBucket::trainInner(const GMatrix& features, const GMatrix& labels) { size_t nLearnerCount = m_models.size(); double dBestError = 1e200; GSupervisedLearner* pLearner; m_nBestLearner = (size_t)m_rand.next(nLearnerCount); double err; for(size_t i = 0; i < nLearnerCount; i++) { pLearner = m_models[i]; err = pLearner->crossValidate(features, labels, 2); if(err < dBestError) { dBestError = err; m_nBestLearner = i; } pLearner->clear(); } pLearner = m_models[m_nBestLearner]; pLearner->train(features, labels); }