Exemple #1
0
        public float[] compete(HiddenLayer hiddenLayer)
        {
            NeuronList  list     = hiddenLayer.getHiddenLayerNeurons();
            IEnumerator listEnum = list.GetEnumerator();

            float[] x = new float[list.Count];
            int     i = 0;

            while (listEnum.MoveNext())
            {
                x[i++] = ((HiddenLayerNeuron)listEnum.Current).getOutput();
            }
            double max      = x[0];
            int    maxIndex = 0;

            for (int j = x.Length - 1; j > 0; j--)
            {
                if (max < x[j])
                {
                    maxIndex = j;
                }
                max = Math.Max(max, x[j]);
            }

            for (int k = 0; k < x.Length; k++)
            {
                x[k] = 0;
                if (k == maxIndex)
                {
                    x[k] = 1;
                }
            }
            return(x);
        }
Exemple #2
0
 public LVQNet(WeightsMatrix wm)
 {
     layerOne = new HiddenLayer(wm.IW);
     layerTwo = new OutputLayer(wm.LW);
 }