@Override public Dataset buildDataset() { Dataset ret = new Dataset(template, Utils.relativize(file)); int inputDim = template.inputTemplate.getDescriptionLength(); int outputDim = template.outputTemplate.getDescriptionLength(); if (file.exists()) { try { int index = 0, count = 0; BufferedReader reader = new BufferedReader(new FileReader(file)); for (String line = reader.readLine(); line != null && count < instanceNumber; line = reader.readLine(), index++) { if (index < startIndex) continue; String[] tokens = line.split(separators); Object input = getData(Arrays.copyOfRange(tokens, 0, inputDim), template.inputTemplate); Object output = getData( Arrays.copyOfRange(tokens, inputDim, inputDim + outputDim), template.outputTemplate); ret.add(template.newInstance(input, output)); count++; } reader.close(); ret.setReadyState(); } catch (IOException e) { } } return ret; }