示例#1
0
        /// <summary>
        /// Creates an instance of Unsuervised Hebian net with specified number
        /// of neurons in input layer and output layer, and transfer function
        /// </summary>
        /// <param name="inputNeuronsNum">
        ///            number of neurons in input layer </param>
        /// <param name="outputNeuronsNum">
        ///            number of neurons in output layer </param>
        /// <param name="transferFunctionType">
        ///            transfer function type </param>
        private void createNetwork(int inputNeuronsNum, int outputNeuronsNum, TransferFunctionType transferFunctionType)
        {
            // init neuron properties
            NeuronProperties neuronProperties = new NeuronProperties();

            //		neuronProperties.setProperty("bias", new Double(-Math
            //				.abs(Math.random() - 0.5))); // Hebbian network cann not work
            // without bias
            neuronProperties.setProperty("transferFunction", transferFunctionType.ToString());
            neuronProperties.setProperty("transferFunction.slope", 1);

            // set network type code
            this.NetworkType = NeuralNetworkType.UNSUPERVISED_HEBBIAN_NET;

            // createLayer input layer
            Layer inputLayer = LayerFactory.createLayer(inputNeuronsNum, neuronProperties);

            this.addLayer(inputLayer);

            // createLayer output layer
            Layer outputLayer = LayerFactory.createLayer(outputNeuronsNum, neuronProperties);

            this.addLayer(outputLayer);

            // createLayer full conectivity between input and output layer
            ConnectionFactory.fullConnect(inputLayer, outputLayer);

            // set input and output cells for this network
            NeuralNetworkFactory.DefaultIO = this;

            // set appropriate learning rule for this network
            this.LearningRule = new UnsupervisedHebbianLearning();
            //this.setLearningRule(new OjaLearning(this));
        }
        /// <summary>
        /// Creates an instance of Supervised Hebbian Network with specified number
        /// of neurons in input layer, output layer and transfer function
        /// </summary>
        /// <param name="inputNeuronsNum">
        ///            number of neurons in input layer </param>
        /// <param name="outputNeuronsNum">
        ///            number of neurons in output layer </param>
        /// <param name="transferFunctionType">
        ///            transfer function type </param>
        private void createNetwork(int inputNeuronsNum, int outputNeuronsNum, TransferFunctionType transferFunctionType)
        {
            // init neuron properties
            NeuronProperties neuronProperties = new NeuronProperties();

            neuronProperties.setProperty("transferFunction", transferFunctionType.ToString());
            neuronProperties.setProperty("transferFunction.slope", 1);
            neuronProperties.setProperty("transferFunction.yHigh", 1);
            neuronProperties.setProperty("transferFunction.xHigh", 1);
            neuronProperties.setProperty("transferFunction.yLow", -1);
            neuronProperties.setProperty("transferFunction.xLow", -1);

            // set network type code
            this.NetworkType = NeuralNetworkType.SUPERVISED_HEBBIAN_NET;

            // createLayer input layer
            Layer inputLayer = LayerFactory.createLayer(inputNeuronsNum, neuronProperties);

            this.addLayer(inputLayer);

            // createLayer output layer
            Layer outputLayer = LayerFactory.createLayer(outputNeuronsNum, neuronProperties);

            this.addLayer(outputLayer);

            // createLayer full conectivity between input and output layer
            ConnectionFactory.fullConnect(inputLayer, outputLayer);

            // set input and output cells for this network
            NeuralNetworkFactory.DefaultIO = this;

            // set appropriate learning rule for this network
            this.LearningRule = new SupervisedHebbianLearning();
        }
示例#3
0
 /// <summary>
 /// Creates an instance of Unsuervised Hebian net with specified number
 /// of neurons in input layer and output layer, and transfer function
 /// </summary>
 /// <param name="inputNeuronsNum">
 ///            number of neurons in input layer </param>
 /// <param name="outputNeuronsNum">
 ///            number of neurons in output layer </param>
 /// <param name="transferFunctionType">
 ///            transfer function type id </param>
 public UnsupervisedHebbianNetwork(int inputNeuronsNum, int outputNeuronsNum, TransferFunctionType transferFunctionType)
 {
     this.createNetwork(inputNeuronsNum, outputNeuronsNum, transferFunctionType);
 }