fork download
  1. void CPairTree::eval(const matrix<float>& data, const std::vector<int>& labels, matrix<float>& forestConfidences) {
  2.  
  3. // Initialize
  4. m_confidences.clear();
  5. m_predictions.clear();
  6. m_confidences.resize(data.size1(), m_hp.numClasses);
  7. m_predictions.resize(data.size1());
  8.  
  9. std::vector<int> sampleIndeces;
  10. sampleIndeces.reserve(data.size1());
  11. for (unsigned int i = 0; i < data.size1(); i++) {
  12. sampleIndeces.push_back(i);
  13. }
  14. m_rootNode->eval(data, sampleIndeces, m_confidences, m_predictions);
  15.  
  16. // Fill the forest confidences
  17. for (unsigned int nSamp = 0; nSamp < data.size1(); nSamp++) {
  18.  
  19. if (m_hp.useSoftVoting) {
  20. for (int nClass = 0; nClass < m_hp.numClasses; nClass++) {
  21. forestConfidences(nSamp,nClass) += m_confidences(nSamp,nClass);
  22. }
  23. }
  24. else {
  25. forestConfidences(nSamp, m_predictions[nSamp])++;
  26. }
  27. }
  28.  
  29. m_hp.verbose = 1;
  30. if (m_hp.verbose) {
  31. cout << "Tree test error: " << computeError(labels) << endl;
  32. }
  33. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:1:7: error: 'CPairTree' has not been declared
prog.cpp:1:29: error: 'matrix' does not name a type
prog.cpp:1:29: error: ISO C++ forbids declaration of 'parameter' with no type
prog.cpp:1:35: error: expected ',' or '...' before '<' token
prog.cpp: In function 'void eval(int)':
prog.cpp:4:3: error: 'm_confidences' was not declared in this scope
prog.cpp:5:3: error: 'm_predictions' was not declared in this scope
prog.cpp:6:24: error: 'data' was not declared in this scope
prog.cpp:6:38: error: 'm_hp' was not declared in this scope
prog.cpp:9:3: error: 'vector' is not a member of 'std'
prog.cpp:9:15: error: expected primary-expression before 'int'
prog.cpp:9:15: error: expected ';' before 'int'
prog.cpp:10:3: error: 'sampleIndeces' was not declared in this scope
prog.cpp:14:3: error: 'm_rootNode' was not declared in this scope
prog.cpp:21:36: error: 'forestConfidences' was not declared in this scope
prog.cpp:25:50: error: 'forestConfidences' was not declared in this scope
prog.cpp:31:4: error: 'cout' was not declared in this scope
prog.cpp:31:48: error: 'labels' was not declared in this scope
prog.cpp:31:54: error: 'computeError' was not declared in this scope
prog.cpp:31:59: error: 'endl' was not declared in this scope
stdout
Standard output is empty