Exemplo n.º 1
0
 public void Update(int t, double delta, double gamma, Iris iris)
 {
     for (int i = 0; i < size; ++i)
     {
         weights[i] = weights[i] + delta * gamma * (iris.Parameters[i] - weights[i]);
     }
 }
Exemplo n.º 2
0
 public void SetDistance(Iris iris)
 {
     for (int i = 0; i < weights.Count(); ++i)
     {
         currentDistance += Math.Pow(iris.Parameters[i] - weights[i], 2);
     }
     currentDistance = Math.Sqrt(currentDistance);
 }
Exemplo n.º 3
0
 public void SetDistance(Iris iris)
 {
     for (int i = 0; i < size; ++i)
     {
         for (int j = 0; j < size; ++j)
         {
             nodes[i, j].SetDistance(iris);
         }
     }
 }
Exemplo n.º 4
0
        public void InsertIris(Iris iris)
        {
            SetDistance(iris);
            Point point = GetCoordinatesOfMinimumDistance();

            /*while(nodes[point.X,point.Y].Objects.Count == 6)
             * {
             *  nodes[point.X, point.Y].CurrentDistance = 100;
             *  point = GetCoordinatesOfMinimumDistance();
             * }*/
            nodes[point.X, point.Y].AddElement(iris);
        }
Exemplo n.º 5
0
        public void WeightUpdate(int t, Iris iris)
        {
            double gammat = GetGamma(t);

            network.SetDistance(iris);
            Point winner = network.GetCoordinatesOfMinimumDistance();
            Point looser = new Point();

            for (int i = 0; i < network.Size; ++i)
            {
                for (int j = 0; j < network.Size; ++j)
                {
                    looser.SetPoint(i, j);
                    double deltat = GetDelta(winner, looser, t, WebType.square);
                    network[i, j].Update(t, deltat, gammat, iris);
                }
            }
        }
Exemplo n.º 6
0
        static void Main(string[] args)
        {
            string      path           = @"IrisDataAll.txt";
            List <Iris> refIrisList    = Iris.prepareIrisDataFromTextFile(path);
            List <Iris> temporaryList  = new List <Iris>();
            SOM         som            = new SOM(7, 5, 1, 1000, refIrisList);
            int         numOfIteration = 3000;
            int         index          = 0;
            Random      rand           = new Random();

            som.Print();
            for (int i = 0; i < numOfIteration; ++i)
            {
                Console.WriteLine("Numer iteracji: {0}", i);
                int j = 0;
                while (refIrisList.Count != 0)
                {
                    index = rand.Next(refIrisList.Count);
                    som.WeightUpdate(j, refIrisList[index]);
                    temporaryList.Add(refIrisList[index]);
                    refIrisList.Remove(refIrisList[index]);
                    //som.Print();
                    ++j;
                }
                refIrisList = new List <Iris>(temporaryList);
                temporaryList.Clear();
                //som.Print();
            }
            som.AssignIris(refIrisList);
            Console.WriteLine("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
            som.PrintWithIris();



            Console.ReadLine();
        }
Exemplo n.º 7
0
 public void AddElement(Iris iris)
 {
     objects.Add(iris);
 }