Ejemplo n.º 1
0
        public static Bitmap getMemory(Neiron n)
        {
            double[,] w = n.weight;
            Bitmap b = new Bitmap(w.GetLength(0), w.GetLength(1));

            for (int i = 0; i < w.GetLength(0); i++)
            {
                for (int j = 0; j < w.GetLength(1); j++)
                {
                    Color c;

                    if (w[i, j] <= 0)
                    {
                        c = Color.White;
                    }
                    else
                    {
                        c = Color.Black;
                    }

                    c = Color.FromArgb((int)(255 * w[i, j]), Color.Black);
                    b.SetPixel(i, j, c);
                }
            }

            return(b);
        }
Ejemplo n.º 2
0
        public static Neiron neironCreate(Dictionary <String, Object> o)
        {
            Neiron res = new Neiron();

            res.name       = (string)o["name"];
            res.countTrain = (int)o["countTrain"];

            Object[] weightData = (Object[])o["weight"];
            int      size       = (int)Math.Sqrt(weightData.Length);

            res.weight = new double[size, size];

            int index = 0;

            for (int i = 0; i < res.weight.GetLength(0); i++)
            {
                for (int j = 0; j < res.weight.GetLength(1); j++)
                {
                    res.weight[i, j] = Double.Parse(weightData[index].ToString());
                    index++;
                }
            }

            return(res);
        }
Ejemplo n.º 3
0
        public Neiron create(String name)
        {
            Neiron n = new Neiron();

            n.clear(name, neironWidth, neironHeight);
            this.neirons.Add(n);

            return(n);
        }
Ejemplo n.º 4
0
        public void setTrain(String trainName, int[,] data)
        {
            Neiron neiron = getByName(trainName);

            if (neiron == null)
            {
                neiron = create(trainName);
            }

            int countTrain = neiron.train(data);

            MessageBox.Show("Litera - " + neiron.name + " count train = " + countTrain.ToString());
        }