Exemple #1
0
        private void btnTreinar_Click(object sender, RoutedEventArgs e)
        {
            StreamWriter x;
            string       caminhoExe     = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            string       caminhoArquivo = System.IO.Path.Combine(caminhoExe, "treino.txt");

            x = File.CreateText(caminhoArquivo);
            String atu;
            BackpropagationClass backpropagation = new BackpropagationClass();

            for (int j = 1; j < EPOCAS_TREINAMENTO; j++)
            {
                atu = imgResultado.Text;
                imgResultado.Text = atu + "epoca: " + j + "\n";


                x.WriteLine("epoca: " + j);

                for (int i = 0; i < DADOS.Length; i++)
                {
                    x.WriteLine(backpropagation.busca(DADOS[i][0]).recalculaErro(DADOS[i][1][0]));
                    atu = imgResultado.Text;
                    imgResultado.Text = atu + backpropagation.busca(DADOS[i][0]).recalculaErro(DADOS[i][1][0]) + "\n";
                }

                atu = imgResultado.Text;
                imgResultado.Text = atu + "\n";
            }


            x.WriteLine("fIM");
            x.Close();
        }
Exemple #2
0
        private void btnRodar_Click(object sender, RoutedEventArgs e)
        {
            StreamWriter x;
            string       caminhoExe     = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            string       caminhoArquivo = System.IO.Path.Combine(caminhoExe, "execucao.txt");

            x = File.CreateText(caminhoArquivo);
            BackpropagationClass backpropagation = new BackpropagationClass();

            double[] result = new double[] { 0, 0, 0, 0 };
            for (int i = 0; i < DADOS.Length; i++)
            {
                result[i] = backpropagation.busca(DADOS[i][0]).getNeuronios()[BackpropagationClass.NEURONIO_ENTRADA + BackpropagationClass.NEURONIO_OCULTO].getSaida();
                x.WriteLine(result[i]);;
            }
            x.WriteLine("fIM");
            x.Close();
        }