Exemple #1
0
 public void Correct(TNeuron Win, TX X)
 {
     for (int i = 0; i < N; i++)
     {
         Win.w[i] = Win.w[i] + nu * (X.x[i] - Win.w[i]);
     }
 }
Exemple #2
0
        public void Add(TX X, double dnu)
        {
            if (Count < 1)
            {
                Map.Add(new TNeuron(N, X.x, null));
                return;
            }

            double R;

            TNeuron Win = Winner(X, out R);

            if (R < Rc)
            {
                Correct(Win, X);
            }
            else
            {
                Map.Add(new TNeuron(N, X.x, null));
            }

            nu = nu - dnu;

            if (nu < 0)
            {
                nu = 0;
            }
        }
Exemple #3
0
        public TNeuron Winner(TX X, out double R)
        {
            TNeuron res = this[0];

            R = res.R(X.x);

            for (int i = 1; i < Count; i++)
            {
                double d = this[i].R(X.x);

                if (d < R)
                {
                    R   = d;
                    res = this[i];
                }
            }

            return(res);
        }
Exemple #4
0
        public int GetClass(TX X)
        {
            if (Count < 1)
            {
                return(-1);
            }

            double R;

            TNeuron Win = Winner(X, out R);

            if (R < Rc)
            {
                return(Map.IndexOf(Win));
            }
            else
            {
                return(-1);
            }
        }