/** Generate the training sets. */ public void generate() { sortPoints(); final int start = calculateStartIndex() + 1; final int setSize = calculateActualSetSize(); final int range = start + setSize - this.predictWindowSize - this.inputWindowSize; for (int i = start; i < range; i++) { final BasicMLData input = generateInputNeuralData(i); final BasicMLData ideal = generateOutputNeuralData(i + this.inputWindowSize); final BasicMLDataPair pair = new BasicMLDataPair(input, ideal); super.add(pair); } }
/** * Load from the specified node. * * @param pairs The pairs to load. * @return The EncogPersistedObject that was loaded. */ public EncogPersistedObject load(final Element pairs) { final String name = pairs.getAttribute("name"); final String description = pairs.getAttribute("description"); final BasicNeuralDataSet result = new BasicNeuralDataSet(); result.setName(name); result.setDescription(description); for (Node child = pairs.getFirstChild(); child != null; child = child.getNextSibling()) { if (!(child instanceof Element)) { continue; } final Element node = (Element) child; if (child.getNodeName().equals(this.pairXML)) { final NeuralDataPair pair = loadPair(node); result.add(pair); } } return result; }