Exemplo n.º 1
0
        public HopfieldNetwork(int dim, double forgetRatio)
        {
            IList <Neuron> neurons = new List <Neuron>();

            for (int i = 0; i < dim; i++)
            {
                neurons.Add(MemoryNeuron.Create(dim));
            }
            layer            = NetworkLayer.Of(neurons);
            this.forgetRatio = forgetRatio;
        }
Exemplo n.º 2
0
        public static NetworkLayer Of(IList <Neuron> neurons)
        {
            if (neurons == null || neurons.Count < 1)
            {
                throw new ArgumentException(EMPTY_LAYER_MSG);
            }
            if (!AreOfConsistentDimension(neurons))
            {
                throw new ArgumentException(MISALIGNED_NEURONS_MSG);
            }
            NetworkLayer layer = new NetworkLayer();

            layer.neurons = neurons;
            layer.NeuronInputDimension = neurons.First().InputDim;
            return(layer);
        }