예제 #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]);
     }
 }
예제 #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;
            }
        }
예제 #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);
        }
예제 #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);
            }
        }