Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Neural Networks

Status
Not open for further replies.

Leibnitz

Programmer
Apr 6, 2001
393
CA
Does anyone knows how to implement a simple Neural Network using Backpropagation algorithm ?
any ideas or codes are welcome.

Thanks in advance !
 
Believe it or not, I had to do this project for school. Unfortunately, I lost the backpropegation code, but I later developed an application ( in Java ) to handle Graham-Schmidt orthogonalization. It was one of my earlier works, so it's a little messy, but here's the logic: ( I'm sure you'll have no trouble converting it to C++ code, but give a shout if something in my code is unclear )

//orthogonalizes the vectors of a matrix

public double [][] GrahamSchmidt(double [][] ardat,
int row, int column)
{
double temp1,temp2;
double [] temp3;
temp3= new double[column];

double [][] V;
V= new double[row][column];

for (int n=0; n<row; n++) //loops all entries to N = row
{
temp1=0;
temp2=0; //resets temp
//variables to 0
for (int reset=0; reset<column;reset++)
temp3[reset]=0;

for(int p=n; p>=0; p--)
{
if (p==0)
//V(n)=calculations
for (int Vset=0; Vset<column; Vset++)
{
V[n][Vset]=ardat[n][Vset]-temp3[Vset];
}

else
{
temp1 = 0;
temp2 = 0;

for (int loop1=0; loop1<column; loop1++)
{
//X(n)*V(p-1)
temp1 += ardat[n][loop1]*V[p-1][loop1];
}

for (int loop2=0; loop2<column; loop2++)
{
//V(p-1)*V(p-1)
temp2 += V[p-1][loop2]*V[p-1][loop2];
}

if (temp2 == 0)
{
for (int loop3=0; loop3<column; loop3++)
{
temp3[loop3]+=0;
}
}
else
{
for (int loop3=0; loop3<column; loop3++)
{
//X(n)* V(p-1)
//------------- * V(p-1)
//V(p-1)*V(p-1)

temp3[loop3]+=(temp1/temp2)*V[p-1][loop3];
} } // cuts else
} } //cuts current vector calculations
} //cuts all vectors to N loop
return V; //returns ortogonalized matrix
} //cuts method

hopefully it didn't get messed up with my editing and indentation correction.

Anyway, I have a question for you now; I forget what you must do for backpropegation after orthogonalizing a matrix. I remember something about multiplying the matrix by a weight vector or whatever, but I was hoping you could list all of the steps to fill me in.

Thanks in advance.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top