Programa De Redes Neuronales
ainfante2 de Junio de 2015
13.960 Palabras (56 Páginas)245 Visitas
TAREA 02 – UNIDAD I
Aplicación – Redes Neuronales
I.- Datos generales:
1. Facultad: Ingeniera.
2. Carrera Profesional: Ing. De Sistemas.
3. Centro Uladech – Católica: Piura – SEV
4. Nombre de la asignatura: Inteligencia Artificial
5. Semestre académico: I - 2015 Ciclo académico: VIII
6. Nombre del Estudiante: Anderson Infante Bautista.
7. Fecha: 21/05/2015
Pantalla inicial del programa
El programa empieza con la opción de aprendizaje.
Para la ejecución del programa se necesitan crear patrones con un nombre las imagen además de ello aparece un mensaje de registro.
Al término del registro de los 10 patrones con sus nombres; el sistema cambia al modo ejecución como se visualiza en las letras verdes y se activa el botón de comando “Entrenar”
Luego ejecutamos el botón entrenar
Al hacer clic, empezaran a aparecer cuadros de preguntas la cual debemos contestar con valores.
Al final de ello nos pedirá que hagamos clic en el botón CALCULARJ y dibujamos el patrón.
Al tener ello hacemos clic en el botón calcular y esperamos que mensaje nos lanza.
En el resultado vemos que no nos salió ninguna coincidencia con lo que tenemos registrado.
IMÁGENES DE APLICACIÓN CORRIENDO EN NetBeans IDE 8.0.2 – Matriz.java
Red.java
RedesNeuronalesAboutBox.java
RedesNeuronalesApp.java
RedesNeuronalesViewe.java
COIGO FUENTE Matriz.java
packageredesneuronales;
importjava.text.DecimalFormat;
/**
*Clase Matriz
*Clase que define objetos matriz para realizar operaciones de matrices
* de forma rápida y sencilla
* @author Pablo Borbón
*/
publicclass Matriz {
//Campos
int fil=0;
int col=0;
doublemat[][];
//Constructures sobrecargados
/**
*Contructor Matriz
* @param m Arreglo bidimensional de double
*/
public Matriz(double m[][]){
this.mat=m;
this.fil=m.length;
this.col=m[0].length;
}
/**
*Constructor Matriz
* @param m Arreglo unidimensional de double
*/
public Matriz(double m[]){
this.mat=new double[1][m.length];
for (int i=0;i<m.length;i++){
this.mat[0][i]=m[i];
this.fil=1;
this.col=m.length;
}
}
/****************************************************************************
* MÉTODOS
****************************************************************************
*/
/**
* Obtener número de columnas
* @param m Matriz
* @returnintNumColumnas
*/
publicstaticintgetCol(Matriz m){
returnm.col;
}
/**
* Obtener número de columnas
* @returnintNumColumnas
*/
publicintgetCol(){
returnthis.col;
}
/**
* Obtener número de columnas
* @returnStringNumColumnas
*/
publicStringgetColString(){
returnString.valueOf(this.col);
}
/**
* Obtener número de filas
* @param m Matriz
* @returnintNumFilas
*/
publicstaticintgetFil(Matriz m){
returnm.fil;
}
/**
* Obtener número de filas
* @returnintNumFilas
*/
publicintgetFil(){
returnthis.fil;
}
/**
* Obtener número de filas
* @returnStringNumFilas
*/
publicStringgetFilString(){
returnString.valueOf(this.fil);
}
/**
* Convertir matriz en array
* @returnDoublearray[][]
*/
publicdouble[][] toArray(){
returnthis.mat;
}
/**
* Convertir matriz en array
* @param m Matriz
* @returnDoublearray[][]
*/
publicstaticdouble[][] toArray(Matriz m){
returnm.mat;
}
/**
*Colocar valor en posicion[f][c]
* @param f índice de fila
* @param c índice de columna
* @paramvalue Valor que se coloca en el arreglo de la matriz
*/
publicvoidsetFC(intf,int c, doublevalue){
this.mat[f][c]=value;
}
/**
*Obtener valor en posición[f][c]
* @param f índice fila
* @param c índice columna
* @returndouble valor
*/
publicdoublegetFC(intf,int c){
returnthis.mat[f][c];
}
/**
*Convertir la matriz en un String
* @param m Matriz a convertir
* @returnString con las filas y las columnas de la matriz
* debidamente ordenadas.
*/
publicstaticStringtoStringM(Matriz m){
DecimalFormatdf = new DecimalFormat("0.00");
StringBuffer mat1= new StringBuffer();
for (int j=0;j<m.getFil();j++){
for (int i=0;i<m.getCol();i++){
mat1.append(" ");
mat1.append(df.format(m.toArray()[j][i]));
}
mat1.append("\n");
}
String salida = mat1.toString();
return salida;
}
/**
*Convertir Matriz a String
@returnString con las filas y las columnas de la matriz
* debidamente ordenadas.
*/
publicStringtoStringM(){
DecimalFormatdf = new DecimalFormat("0.00");
StringBuffer mat1= new StringBuffer();
for (int j=0;j<this.getFil();j++){
for (int i=0;i<this.getCol();i++){
mat1.append(" ");
mat1.append(df.format((this.toArray()[j][i])));
}
mat1.append("\n");
}
String salida = mat1.toString();
return salida;
}
/**
*Transponer matriz
* @param m matriz a transponer
* @return Matriz m'
*/
publicstatic Matriz transponer(Matriz m){
double retorno[][];
retorno=new double[m.getCol()][m.getFil()];
for (int i=0; i<m.getFil();i++){
for (int j=0; j<m.getCol();j++){
retorno[j][i]=m.toArray()[i][j];
}
}
Matriz ret= new Matriz(retorno);
returnret;
}
/**
*Sumar matrices
* @parammAsumandoA
* @parammBsumandoB
* @return Matriz (ma+mB)
*/
publicstatic Matriz sumar(Matriz mA, Matriz mB){
double retorno[][];
retorno=new double[mB.getFil()][mB.getCol()];
Matriz ret= new Matriz(retorno);
for (int i=0; i<mA.getFil();i++){
for (int j=0; j<mA.getCol();j++){
ret.setFC(i, j, (mA.getFC(i, j)+mB.getFC(i, j)));
}
}
returnret;
}
/**
*Restar matrices
* @parammA Minuendo
* @parammB Sustraendo
* @return Matriz diferencia= mA-mB
*/
publicstatic Matriz restar(Matriz mA, Matriz mB){
double retorno[][];
retorno=new double[mB.getFil()][mB.getCol()];
Matriz ret= new Matriz(retorno);
for (int i=0; i<mA.getFil();i++){
for (int j=0; j<mA.getCol();j++){
ret.setFC(i, j, (mA.getFC(i, j)-mB.getFC(i, j)));
}
}
returnret;
}
publicstatic Matriz multiplicar(Matriz mA, Matriz mB){
double retorno[][];
doubletmp=0;
retorno=new double[mA.getFil()][mB.getCol()];
Matriz ret= new Matriz(retorno);
for (int i=0; i<mA.getFil();i++){
...