public void testClassification() throws Exception {
    File rawFile = TEMP_DIR.createFile("simple.csv");
    File egaFile = TEMP_DIR.createFile("simple.ega");
    File outputFile = TEMP_DIR.createFile("simple_output.csv");

    FileUtil.copyResource("org/encog/data/simple.csv", rawFile);
    FileUtil.copyResource("org/encog/data/simple-r.ega", egaFile);

    EncogAnalyst analyst = new EncogAnalyst();
    analyst.addAnalystListener(new ConsoleAnalystListener());
    analyst.load(egaFile);

    analyst.executeTask("task-full");

    ReadCSV csv = new ReadCSV(outputFile.toString(), true, CSVFormat.ENGLISH);
    while (csv.next()) {
      double diff = Math.abs(csv.getDouble(2) - csv.getDouble(4));
      Assert.assertTrue(diff < 1.5);
    }

    Assert.assertEquals(4, analyst.getScript().getFields().length);
    Assert.assertEquals(3, analyst.getScript().getFields()[3].getClassMembers().size());

    csv.close();
  }
 /**
  * Produce a report for a filename.
  *
  * @param filename The filename.
  */
 public void produceReport(final File filename) {
   try {
     final String str = produceReport();
     FileUtil.writeFileAsString(filename, str);
   } catch (final IOException ex) {
     throw new AnalystError(ex);
   }
 }
 public static String readResourceAsString(String resource) {
   try {
     InputStream is = openResourceInputStream(resource);
     String result = FileUtil.readStreamAsString(is);
     is.close();
     return result;
   } catch (IOException ex) {
     throw new EncogError(ex);
   }
 }