Académique Documents
Professionnel Documents
Culture Documents
INTELIGNCIA ARTIFICIAL
Prof. Keiji Yamanaka
1. Resumo
Neste trabalho ser desenvolvida uma interface grfica na
linguagem de programao C#, utilizando o software Visual Basic
C#. Nesta interface contm as 16 tabelas verdades de duas
entradas, com suas respectivas sadas, a ideia aplicar a regra de
Hebbs uma rede neural artificial, de tal forma a treinar o sistema
para que ele consiga obter a sada correta.
Palavras-chave: C#, regra de Hebbs, RNA, tabela verdade, redes neurais artificiais
Abstract
In this work, will be developed a graphical interface in the C # programming
language using Visual Basic C # software. This interface contains 16 two-input truth
tables, with their respective outputs, the idea is to apply the rule of Hebbs an artificial
neural network, in such a way to train the system so that he can get the correct output.
Keywords: C#, Rule of Hebbs, ANN, artificial neural networks, truth tables
Contedo
1.
Resumo...................................................................................................... 2
2.
Introduo.................................................................................................. 4
3.
Desenvolvimento......................................................................................... 5
4.
Concluso................................................................................................... 7
5.
Referncias Bibliogrficas...........................................................................8
6.
2. Introduo
3. Desenvolvimento
Para o desenvolvimento deste projeto foi necessrio uma breve
reviso acerca do software para desenvolvimento de interfaces
grficas da Microsoft Visual Basic C#. Assim, os clculos para
treinamento de Hebbs foi feito programando cada boto, label e
caixa de texto.
Primeiramente foi criada uma combobox contendo todas as 16
tabelas verdades para duas variveis de entrada, na qual o usurio
deve selecionar a lgica de seu interesse de acordo com a figura 1.
Esta combobox foi programada de tal forma a conter um banco de
dados internamente na linha de cdigo, definindo os valores para
cada label.
4. Concluso
A partir do desenvolvimento deste trabalho foi mais perceptvel para o
estudante as iteraes promovidas pelos pesos afim de treinar a rede neural
com a sada j conhecida para encontrar esta mesma sada com a menor taxa
de erros possvel. Como no foram adicionados rudos na sada no possvel
perceber o tratamento da regra de Hebbs para esse tipo de anomalia, porm
esta funcionalidade ainda ser implementada.
5. Referncias Bibliogrficas
[1] http://www.lncc.br/~labinfo/tutorialRN/frm1_introducao.htm.
Acedido dia 06/05/2014.
[2]
http://www2.ica.ele.puc-rio.br/Downloads/30/ICA-Aula-2bPerceptron.pdf
[3]
ftp://ftp.dca.fee.unicamp.br/pub/docs/vonzuben/ia353_03/topico5
_03.pdf
[4]
http://pt.slideshare.net/jkbrandao/redes-neurais-artificiaisregras-de-aprendizado
[5]
http://www.decom.ufop.br/imobilis/wpcontent/uploads/2012/06/02_Treinamento-e-Aprendizado-emRNAs.pdf
System;
System.Collections.Generic;
System.ComponentModel;
System.Data;
System.Drawing;
System.Linq;
System.Text;
System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Saida_escolha_SelectedIndexChanged(object sender, EventArgs e)
{
if (Saida_escolha.SelectedIndex == 0)
{
Y1.Text = "-1";
Y2.Text = "-1"; //Sada 0
Y3.Text = "-1";
Y4.Text = "-1";
}
else if (Saida_escolha.SelectedIndex == 1)
{
Y1.Text = "-1";
Y2.Text = "-1";
Y3.Text = "-1";// Sada 1
Y4.Text = " 1";
}
else if (Saida_escolha.SelectedIndex == 2)
{
Y1.Text = "-1";
Y2.Text = "-1";
Y3.Text = " 1";//Sada 2
Y4.Text = "-1";
}
else if (Saida_escolha.SelectedIndex == 3)
{
Y1.Text = "-1";
Y2.Text = "-1";
Y3.Text = " 1";// Sada 3
Y4.Text = " 1";
}
else if (Saida_escolha.SelectedIndex == 4)
{
Y1.Text = "-1";
Y2.Text = " 1";// 4
Y3.Text = "-1";
Y4.Text = " 1";
}
else if (Saida_escolha.SelectedIndex == 5)
{
Y1.Text = "-1";
Y2.Text = " 1";
Y3.Text = "-1"; //5
Y4.Text = " 1";
}
else if (Saida_escolha.SelectedIndex
{
Y1.Text = "-1";
Y2.Text = " 1"; //6
Y3.Text = " 1";
Y4.Text = "-1";
}
else if (Saida_escolha.SelectedIndex
{
Y1.Text = "-1";
Y2.Text = " 1";
Y3.Text = " 1"; // 7
Y4.Text = " 1";
}
else if (Saida_escolha.SelectedIndex
{
Y1.Text = " 1";
Y2.Text = "-1"; //8
Y3.Text = "-1";
Y4.Text = " 1";
}
else if (Saida_escolha.SelectedIndex
{
Y1.Text = " 1";
Y2.Text = "-1"; // 9
Y3.Text = "-1";
Y4.Text = " 1";
}
else if (Saida_escolha.SelectedIndex
{
Y1.Text = " 1";
Y2.Text = "-1"; //10
Y3.Text = " 1";
Y4.Text = "-1";
}
else if (Saida_escolha.SelectedIndex
{
Y1.Text = " 1";
Y2.Text = "-1";
Y3.Text = " 1";//11
Y4.Text = " 1";
}
else if (Saida_escolha.SelectedIndex
{
Y1.Text = " 1";
Y2.Text = " 1";//12
Y3.Text = "-1";
Y4.Text = "-1";
}
else if (Saida_escolha.SelectedIndex
{
Y1.Text = " 1";
Y2.Text = " 1";
Y3.Text = "-1";//13
Y4.Text = " 1";
}
else if (Saida_escolha.SelectedIndex
{
Y1.Text = " 1";
Y2.Text = " 1";//14
Y3.Text = " 1";
Y4.Text = "-1";
}
else if (Saida_escolha.SelectedIndex
{
Y1.Text = " 1";
== 6)
== 7)
== 8)
== 9)
== 10)
== 11)
== 12)
== 13)
== 14)
== 15)
b4.Text = Y4.Text;
}
catch
{
MessageBox.Show("Escolha uma sada.");
}
}
private void Treino_Click(object sender, EventArgs e)
{
int W1 = 0, W2 = 0, B = 0, a, bi, c, d;
try
{
//Treinamento w1
a = W1 + Convert.ToInt16(w11.Text);
bi = a + Convert.ToInt16(w12.Text);
c = bi + Convert.ToInt16(w13.Text);
d = c + Convert.ToInt16(w14.Text);
w1.Text = Convert.ToString(d);
//Treinamento w2
a = W2 + Convert.ToInt16(w21.Text);
bi = a + Convert.ToInt16(w22.Text);
c = bi + Convert.ToInt16(w23.Text);
d = c + Convert.ToInt16(w24.Text);
w2.Text = Convert.ToString(d);
//Treinamento b
a = B + Convert.ToInt16(b1.Text);
bi = a + Convert.ToInt16(b2.Text);
c = bi + Convert.ToInt16(b3.Text);
d = c + Convert.ToInt16(b4.Text);
b.Text = Convert.ToString(d);
}
catch
{
MessageBox.Show("Calcule primeiro os parmetros!");
}
}
private void teta_KeyPress(object sender, KeyPressEventArgs e)
{
char ch = e.KeyChar;
if (!Char.IsDigit(ch) && ch != 8 && ch == 45)
{
e.Handled = true;
}
}
private void Testar_Click(object sender, EventArgs e)
{
// mensagem para o usuario no deixar o campo Limiar em branco
string texto = teta.Text;
string texto1 = X1.Text;
string texto2 = X2.Text;
if (teta.Text != "" || X1.Text != "" || X2.Text != "")
{
}
else
{
MessageBox.Show(" Insira os valores \n de X1, X2 e Limiar");
}
//Teste do neurnio
int nw1, nw2, b1, xis1, xis2, net, tets;
nw1 = Convert.ToInt16(w1.Text);
nw2 = Convert.ToInt16(w2.Text);
b1 = Convert.ToInt16(b.Text);
xis1 = Convert.ToInt16(X1.Text);
xis2 = Convert.ToInt16(X2.Text);
tets = Convert.ToInt16(teta.Text);
net = nw1 * xis1 + nw2 * xis2 + b1;
if (net >= tets)
{
Y.Text = "1";
}
else
{
Y.Text = "-1";
}
}
private void button1_Click(object sender, EventArgs e)
{
w1.Clear();
w2.Clear();
w11.Clear();
w12.Clear();
w13.Clear();
w14.Clear();
w21.Clear();
w22.Clear();
w23.Clear();
w24.Clear();
b.Clear();
b1.Clear();
b2.Clear();
b3.Clear();
b4.Clear();
Y1.Clear();
Y2.Clear();
Y3.Clear();
Y4.Clear();
teta.Clear();
X1.Clear();
X2.Clear();
Y.Clear();
}
}