@Override
 public void execute() {
   printer.print("Executing output features as csv process: ");
   printer.print("loading segments...");
   List<Segment> trainSet = loadFromJsonAndUpdateSegments(pathManager.getTrainSetPath());
   List<Segment> testSet = loadFromJsonAndUpdateSegments(pathManager.getTestSetPath());
   List<Segment> validationSet = loadFromJsonAndUpdateSegments(pathManager.getValidationSetPath());
   List<Segment> unclassified = getUnclassifiedSegments();
   printer.print("saving output...");
   String csv = segmentsCsvBuilder.buildCsv(trainSet, testSet, validationSet, unclassified);
   saveOutputToFile(csv);
   schemaToJobDirectorySaver.saveSchemaToJobDirectory();
   printer.print("done.\n");
 }
 private void saveOutputToFile(String output) {
   String testResultPath = pathManager.getFeaturesCsvPath();
   File file = new File(testResultPath);
   PrintWriter printWriter = null;
   try {
     printWriter = new PrintWriter(file);
     printWriter.print(output);
   } catch (FileNotFoundException e) {
     throw new RuntimeException("Could not write result log to file (" + testResultPath + ").", e);
   } finally {
     if (printWriter != null) {
       printWriter.close();
     }
   }
 }