final CSVFormat format = this.analyst.getScript().determineFormat();
CSVHeaders analystHeaders = new CSVHeaders(file, headers,
format);
ReadCSV csv = new ReadCSV(file.toString(), headers, format);
for (final AnalystField field : analyst.getScript().getNormalize()
.getNormalizedFields()) {
field.init();
}
TimeSeriesUtil series = new TimeSeriesUtil(analyst,true,
analystHeaders.getHeaders());
try {
// write file contents
while (csv.next()) {
double[] output = AnalystNormalizeCSV.extractFields(
this.analyst, analystHeaders, csv, totalCount,
false);
if (series.getTotalDepth() > 1) {
output = series.process(output);
}
MLDataPair pair = BasicMLDataPair.createPair(inputCount,outputCount);
for(int i=0;i<inputCount;i++) {
pair.getInput().setData(i, output[i]);
}
for(int i=0;i<outputCount;i++) {
pair.getIdeal().setData(i, output[i+inputCount]);
}
result.add(pair);
}
return result;
} finally {
if (csv != null) {
try {
csv.close();
} catch (final Exception ex) {
EncogLogging.log(ex);
}
}
}