/** Calculate how many input and output neurons will be needed for the current data. */ public void calculateNeuronCounts() { this.inputNeuronCount = 0; this.outputNeuronCount = 0; for (final TemporalDataDescription desc : this.descriptions) { if (desc.isInput()) { this.inputNeuronCount += this.inputWindowSize; } if (desc.isPredict()) { this.outputNeuronCount += this.predictWindowSize; } } }
/** * Generate neural ideal data for the specified index. * * @param index The index to generate for. * @return The neural data generated. */ public BasicNeuralData generateOutputNeuralData(final int index) { if (index + this.predictWindowSize > this.points.size()) { final String str = "Can't generate prediction temporal data " + "beyond the end of provided data."; throw new TemporalError(str); } final BasicNeuralData result = new BasicNeuralData(this.outputNeuronCount); int resultIndex = 0; for (int i = 0; i < this.predictWindowSize; i++) { int descriptionIndex = 0; for (final TemporalDataDescription desc : this.descriptions) { if (desc.isPredict()) { result.setData(resultIndex++, formatData(desc, index + i)); } descriptionIndex++; } } return result; }