/// <summary>
        /// Constructor to be used for non testing code.
        /// </summary>
        /// <param name="config"></param>
        public FeedForwardNeuralNetwork(NeuralNetworkConfig config)
        {
            int numberOfInputNeurons = config
                                       .GetParameterAsInteger(NUMBER_OF_INPUTS);
            int numberOfHiddenNeurons = config
                                        .GetParameterAsInteger(NUMBER_OF_HIDDEN_NEURONS);
            int numberOfOutputNeurons = config
                                        .GetParameterAsInteger(NUMBER_OF_OUTPUTS);

            double lowerLimitForWeights = config
                                          .GetParameterAsDouble(LOWER_LIMIT_WEIGHTS);
            double upperLimitForWeights = config
                                          .GetParameterAsDouble(UPPER_LIMIT_WEIGHTS);

            hiddenLayer = new Layer(numberOfHiddenNeurons, numberOfInputNeurons,
                                    lowerLimitForWeights, upperLimitForWeights,
                                    new LogSigActivationFunction());

            outputLayer = new Layer(numberOfOutputNeurons, numberOfHiddenNeurons,
                                    lowerLimitForWeights, upperLimitForWeights,
                                    new PureLinearActivationFunction());
        }
예제 #2
0
        /// <summary>
        /// Constructor to be used for non testing code.
        /// </summary>
        /// <param name="config"></param>
        public FeedForwardDeepNeuralNetwork(NeuralNetworkConfig config, IActivationFunction activationFunction)
        {
            if (config.GetParameterAsInteger(NUMBER_OF_HIDDEN_LAYERS) < 1)
            {
                throw new ArgumentOutOfRangeException("NUMBER_OF_HIDDEN_LAYERS must be >= 1");
            }

            if (null == activationFunction)
            {
                activationFunction = new LogSigActivationFunction();
            }
            this.config = config;

            int numberOfInputNeurons  = config.GetParameterAsInteger(NUMBER_OF_INPUTS);
            int numberOfOutputNeurons = config.GetParameterAsInteger(NUMBER_OF_OUTPUTS);

            double lowerLimitForWeights = config.GetParameterAsDouble(LOWER_LIMIT_WEIGHTS);
            double upperLimitForWeights = config.GetParameterAsDouble(UPPER_LIMIT_WEIGHTS);

            hiddenLayers = new Layer[config.GetParameterAsInteger(NUMBER_OF_HIDDEN_LAYERS)];

            //TODO: Create Hidden layers here
        }