int SVM::check_question_set(States& qset) { if (main_equation == NULL) return -1; std::cout << " [" << qset.traces_num() << "]"; for (int i = 0; i < qset.p_index; i++) { int pre = -1, cur = 0; std::cout << "."; //std::cout << "\t\t" << i << ">"; //gsets[QUESTION].print_trace(i); for (int j = qset.index[i]; j < qset.index[i + 1]; j++) { cur = Equation::calc(main_equation, qset.values[j]); //std::cout << ((cur >= 0) ? "+" : "-"); if ((pre >= 0) && (cur < 0)) { // deal with wrong question trace. // Trace back to print out the whole trace and the predicted labels. std::cerr << "\t\t[FAIL]\n \t Predict wrongly on Question traces." << std::endl; qset.print_trace(i); for (int j = qset.index[i]; j < qset.index[i + 1]; j++) { cur = Equation::calc(main_equation, qset.values[j]); std::cout << ((cur >= 0) ? "+" : "-"); } std::cout << std::endl; return -1; } pre = cur; } //std::cout << "END" << std::endl; } std::cout << " [PASS]"; return 0; }