bool RegEvalOp::initialize(StateP state) { state->getContext()->environment = this; voidP sptr = state->getRegistry()->getEntry("classesNum"); classesNum = *((uint *) sptr.get()); std::string outputPath = *((std::string*) state->getRegistry()->getEntry("resultsfile").get()); std::ofstream outfile; outfile.open(outputPath.c_str()); if (!outfile.is_open()) { ECF_LOG_ERROR(state, "Error: Can't open output file " + outputPath); return false; } outfile << "Gen_No,Training,Test" << std::endl; outfile.close(); sptr = state->getRegistry()->getEntry("inputfile"); std::string filePath = *((std::string *) sptr.get()); ifstream file; file.open(filePath.c_str()); if (!file.is_open()) { ECF_LOG_ERROR(state, "Error: Can't open input file " + filePath); return false; } parseFile(domain, codomain, file); file.close(); sptr = state->getRegistry()->getEntry("testfile"); filePath = *((std::string *) sptr.get()); file.open(filePath.c_str()); if (!file.is_open()) { ECF_LOG_ERROR(state, "Error: Can't open test file " + filePath); return false; } parseFile(testDomain, testCodomain, file); file.close(); sptr = state->getRegistry()->getEntry("classesfile"); filePath = *((std::string *) sptr.get()); file.open(filePath.c_str()); if (!file.is_open()) { generateDefaultClasses(); } else { generateParsedClasses(file); } file.close(); for (auto& entry: classes) { f1Score.insert(std::make_pair(entry.first, std::vector<uint>(3, 0))); } return true; }