Exemplo n.º 1
0
 private void MouseDownEvent(object sender, MouseEventArgs e)
 {
     GlobalDrawingIndex = 0;
     if (hasDrawn == false)
     {
         drawing = true;
         x       = e.X;
         y       = e.Y;
         fPoint nov = new fPoint(x, y, true); //Fixate first point !
         nov.drawingIndex = GlobalDrawingIndex;
         GlobalDrawingIndex++;
         points.ADD(nov);
         nov.output();
     }
 }
Exemplo n.º 2
0
        private void MouseUpEvent(object sender, MouseEventArgs e)
        {
            if (guessing == true)
            {
                lbNetwork.Text = "GUESSING...";
            }


            fPoint nov = new fPoint(x, y, true); // Fixate last point !

            nov.drawingIndex = GlobalDrawingIndex;
            GlobalDrawingIndex++;
            points.ADD(nov);
            nov.output();
            hasDrawn = true;
            drawing  = false;
            x        = -1;
            y        = -1;

            int N  = Int32.Parse(vektBox.Text);
            int N2 = N / 2;


            if (points.COUNT() < N || points.COUNT() == N)
            {
                Console.WriteLine("There is not enough points, number of points = " + points.COUNT() + ",  given N = " + N);
                CLEAR();
            }
            else
            {
                Console.WriteLine("Number of points = " + points.COUNT() + ", given N = " + N);

                if (N % 2 != 0) // if N is not even, make it even, by adding 1 to it
                {
                    N++;
                }

                if (training == true)
                {
                    N = Int32.Parse(vektBox.Text);

                    int symbol = Int32.Parse(symBox.Text);

                    VECTORIZE(N2);

                    train.makeExample(vectors, symbol);

                    CLEAR();
                }

                if (guessing == true)
                {
                    string guess = "...";

                    train.GuessingMode();

                    N = train.N;

                    int symbol = Int32.Parse(symBox.Text);

                    VECTORIZE(N2);

                    train.makeGuessingExample(vectors, symbol);

                    List <double> inputVals = new List <double>(), targetVals = new List <double>(), resultVals = new List <double>();

                    train.getTopology();

                    if (train.getNextInputs(inputVals) != train.topology[0])
                    {
                        Console.WriteLine("TOPOLOGY IS NOT EQUAL !!!!");
                    }
                    else
                    {
                        myNet.feedFoward(inputVals);

                        myNet.getResults(resultVals);

                        Console.WriteLine("Pass: "******"Inputs: ", inputVals);
                        showValues("Outputs: ", resultVals);

                        Console.WriteLine();
                    }

                    Console.WriteLine("Done !");

                    guess = getGuess(resultVals);

                    lbNetwork.Text = "MY GUESS IS: " + guess;

                    train.GuessingModeOff();
                }
            }
        }