Example #1
0
        public static RedeAtivacao RedeT()
        {
            DatabaseEntities entities = new DatabaseEntities();
            RedeServices services = new RedeServices();

            var query = from q in entities.CONFIG
                        where q.onda == "T"
                        select q;

            if (entities.CONFIG.Count(q => q.onda == "T") == 0)
                return null;

            CONFIG conf = (CONFIG)query.First();

            string descr = conf.descr;

            return services.Setup(descr, RedeServices.Tipo.Ativacao);
        }
Example #2
0
        private void buttonQRSSalvar_Click(object sender, EventArgs e)
        {
            RedeAtivacao rede = new RedeAtivacao(new SigmoideFuncaoAtivacao(), int.Parse(textBoxQRSEntradas.Text), Utils.StringToInt(textBoxQRSNeuronios.Text));
            RedeServices service = new RedeServices();
            rede.Descricao = textBoxQRSDesc.Text;
            rede.Aleatorizar();
            service.Salvar(rede, RedeServices.Tipo.Ativacao, "QRS");
            MessageBox.Show("Rede salva com sucesso!");
            textBoxQRSDesc.Text = "";
            textBoxQRSEntradas.Text = "";
            textBoxQRSNeuronios.Text = "";

            AtualizarCombos();
        }
Example #3
0
        private void TreinarQRS()
        {
            DatabaseEntities entities = new DatabaseEntities();
            List<ComplexoQRS> qrslist = new List<ComplexoQRS>();
            double erro = 1;
            double taxaerro = double.Parse(textBoxTaxaErro.Text);
            int count = 0;

            var query = from q in entities.QRS
                        select q;

            foreach (QRS qrs in query)
            {
                qrslist.Add(new ComplexoQRS(qrs));
            }

            AprendizadoBackPropagation abp = new AprendizadoBackPropagation(ECGConfig.RedeQRS());

            double coeficiente = taxaerro;

            while (coeficiente >= taxaerro)
            {
                foreach (ComplexoQRS qrs in qrslist)
                {
                    erro += abp.Executar(qrs.Vetor, qrs.Diagnostico);
                    count++;

                    coeficiente = erro / count;

                    treinamentoChart.Invoke(this.chartDelegate, coeficiente);
                    labelQtdeIteracoesResult.Invoke(this.itDelegate, count.ToString());
                    labelTxErroResult.Invoke(this.txErroDelegate, coeficiente.ToString());
                }
            }

            RedeAtivacao rede = abp.Rede;

            foreach (ComplexoQRS qrs in qrslist)
            {
                double[] saida = Utils.AproximarDiagnostico(rede.Calcular(qrs.Vetor));

                Console.WriteLine("Saída da rede treinada: {0}-{1}-{2}-{3}", saida[0], saida[1], saida[2], saida[3]);
            }

            RedeServices services = new RedeServices();

            services.Salvar(abp.Rede, RedeServices.Tipo.Ativacao, "QRS");

            MessageBox.Show("Treinamento concluído com sucesso!\nRede salva no banco de dados");
        }