saveCommand(options.outputCommandFile);
//Get and preprocess the data
MessageSet messages = this.loadMessages(options.inputCSVFile);
Segmentation segmentation = factory.constructSegmentation();
SegmentSet segments = segmentation.segment(messages);
//Set up a cross validation controller.
CrossValidationController crossValidationController = new CrossValidationController();
//Configure controller
factory.configureCrossValidation(crossValidationController);
//Run cross validation
crossValidationController.setSegmentSet(segments);
crossValidationController.run();
EvaluationReport evalReport = crossValidationController.getEvaluationReport();
if (evalReport != null) {
System.out.println("== Saving Results of Cross Validation ==");
saveEvaluationReport(evalReport, options.outputEvaluationReportFile);
System.out.println("Aggregated cross-validation report:");
System.out.println(evalReport);
System.out.println("---------");
if (options.makeROC) {
options.outputROCDir.mkdirs();
for (ROC roc : evalReport.getROCs()) {
String fileName = roc.getName() + FileNames.ROC_SUFFIX;
File outputFile = new File(options.outputROCDir, fileName);
saveROC(roc, outputFile);
}
}
if (options.outputTests) {
options.outputTestsDir.mkdirs();
List<SegmentSet> testSets = evalReport.getTestSets();
List<String> testSetNames = evalReport.getTestSetNames();
SegmentSet combined = new SegmentSet();
for (int i = 0; i < testSets.size(); i++) {
String fileName = testSetNames.get(i) + FileNames.TEST_DATA_SUFFIX;
SegmentSet testSet = testSets.get(i);
combined.addAll(testSet.getSegments());
File outputFile = new File(options.outputTestsDir, fileName);
saveMessages(testSet.getMessages(messages), outputFile);
}
String fileName = FileNames.OUTPUT_TEST_DATA_COMBINED_NAME;
File outputFile = new File(options.outputTestsDir, fileName);
saveMessages(combined.getMessages(messages), outputFile);