Example #1
0
        /* Method: SetTrainData
         *
         *  Set the training data to the input and output data provided.
         *
         *  A copy of the data is made so there are no restrictions on the
         *  allocation of the input/output data..
         *
         * Parameters:
         *   dataLength      - The number of training data
         *   input      - The set of inputs (an array with the dimension dataLength*inputCount)
         *   output     - The set of desired outputs (an array with the dimension dataLength*inputCount)
         *
         *  See also:
         *      <Input>, <Output>
         */
        public void SetTrainData(uint dataLength, double[] input, double[] output)
        {
            uint numInput  = (uint)input.Length / dataLength;
            uint numOutput = (uint)output.Length / dataLength;

            InternalData.set_train_data(dataLength, numInput, input, numOutput, output);
        }
Example #2
0
        /* Method: SetTrainData
         *
         *  Set the training data to the input and output data provided.
         *
         *  A copy of the data is made so there are no restrictions on the
         *  allocation of the input/output data.
         *
         * Parameters:
         *   input      - The set of inputs (an array of arrays of double data)
         *   output     - The set of desired outputs (an array of arrays of double data)
         *
         *  See also:
         *      <Input>, <Output>
         */
        public void SetTrainData(double[][] input, double[][] output)
        {
            int dataLength  = input.Length;
            int inputCount  = input[0].Length;
            int outputCount = output[0].Length;

            double[] arrayInput  = new double[dataLength * inputCount];
            double[] arrayOutput = new double[dataLength * outputCount];
            for (int i = 0; i < dataLength; i++)
            {
                for (int j = 0; j < inputCount; j++)
                {
                    arrayInput[i * inputCount + j] = input[i][j];
                }
                for (int j = 0; j < outputCount; j++)
                {
                    arrayOutput[i * outputCount + j] = output[i][j];
                }
            }
            InternalData.set_train_data((uint)dataLength, (uint)inputCount, arrayInput, (uint)outputCount, arrayOutput);
        }