0 <-(output neuron)
^
|
<- 0<---
| ^ ^
| | |
---> 0 <-(input neuron)
Recurrent Neural Networks
We have heard of them and what they can do. But has anyone actually implemented one? what a recurrent neural network kinda looks like. Way more possibilities though. <horribly bad ASCII art depiction> </horribly bad ASCII art depiction> I was wondering if they could tell me how long they usually think training takes, compared to normal feed forward networks. Also, when you first run it, how do you deal with the input connections from other neurons? In general, what is your experiance with them
I"ve been thininking of something similar.
I was thinking of having layers of neural nets, forming a torus (donut, to the homer simpson fans).
You take the output values to be some of the neurons. You change the output of a few neurons to be what the input values are.
Back propogation wouldn't work when training, so i was thinking differently.
I was thinking of somthing like simulated aneeling, just the local temperature fluctuates, based on neurotransmitters.
The transmitters would move, like in a diffusion simulation, and eventually die out.
They are produced as the network as a whole gets better or worse.
[grin] Great minds think alike....
For the new inputs, you should set them all to a neutral value, like 0.
From,
Nice coder
I was thinking of having layers of neural nets, forming a torus (donut, to the homer simpson fans).
You take the output values to be some of the neurons. You change the output of a few neurons to be what the input values are.
Back propogation wouldn't work when training, so i was thinking differently.
I was thinking of somthing like simulated aneeling, just the local temperature fluctuates, based on neurotransmitters.
The transmitters would move, like in a diffusion simulation, and eventually die out.
They are produced as the network as a whole gets better or worse.
[grin] Great minds think alike....
For the new inputs, you should set them all to a neutral value, like 0.
From,
Nice coder
Click here to patch the mozilla IDN exploit, or click Here then type in Network.enableidn and set its value to false. Restart the browser for the patches to work.
From my limited experience (about a year toying with different neural nets + other AI gizmos) pretty much everything about a neural network (topology, learning algorithm, parameters) depends on the problem you are presenting it.
Simple recurrent perceptron networks can learn time delayed patterns (how many timesteps away depends on the time delays of recurrent links). More complicated recurrent networks (LTSM) can "remember" over large time periods (thousands of timesteps).
Recurrent networks with hebbian learning rules (neurons that fire together, wire together) can be used as associative memories. These associate a pattern of inputs with another, in constrast to perceptron networks which are generally used to classify inputs as belonging to some category.
If you use spiking neurons operating in real-time (or very fine-grained timesteps) and hook them up in recurrent topologies you get all sorts of funky dynamics...that's a huge area of research right now.
Recurrent spiking networks can be used for time-delayed action sequences (synfire chains: neuron1 fires, 200ms later neuron2 fires, 10ms later neuron3 fires), and a slew of other things.
If you're interested in the last category, there is a good introductory paper...I think the name is "The Hebbian Paradigm Reintegrated" (blah, ugly name)...I can't remember the author.
-Alex
Simple recurrent perceptron networks can learn time delayed patterns (how many timesteps away depends on the time delays of recurrent links). More complicated recurrent networks (LTSM) can "remember" over large time periods (thousands of timesteps).
Recurrent networks with hebbian learning rules (neurons that fire together, wire together) can be used as associative memories. These associate a pattern of inputs with another, in constrast to perceptron networks which are generally used to classify inputs as belonging to some category.
If you use spiking neurons operating in real-time (or very fine-grained timesteps) and hook them up in recurrent topologies you get all sorts of funky dynamics...that's a huge area of research right now.
Recurrent spiking networks can be used for time-delayed action sequences (synfire chains: neuron1 fires, 200ms later neuron2 fires, 10ms later neuron3 fires), and a slew of other things.
If you're interested in the last category, there is a good introductory paper...I think the name is "The Hebbian Paradigm Reintegrated" (blah, ugly name)...I can't remember the author.
-Alex
Hiya
The article was by daniel amit on the 30th of April 2001.
Full text as HTML
Archive of it
From,
Nice coder
The article was by daniel amit on the 30th of April 2001.
Full text as HTML
Archive of it
From,
Nice coder
Click here to patch the mozilla IDN exploit, or click Here then type in Network.enableidn and set its value to false. Restart the browser for the patches to work.
Nice Coder: Thanks a lot for finding it.
A little background: Amit mentions Miyashita's experiments. These were live cell recordings from a macaque monkey's brain (inferior temporal region I think...the "What is it?" zone of the visual stream). The monkey was presented with known and unknown visual patterns on a screen.
Known patterns would cause patterns of spiking that would last long after the visual pattern was turned off. Unknown patterns (ones the monkey had not been trained with) caused a little activity that quickly died away.
Amit believes this to be evidence of recurrent modules in the brain (groups of cells much more tightly connected with each other than the rest of the brain) in which recurrent connections keep the module spiking long after any recognized input is presented.
Ummm...that's roughly it...now go read the paper.
I'm not sure how something of this complexity can be used for games or if anyone has ever tried.
-Alex
A little background: Amit mentions Miyashita's experiments. These were live cell recordings from a macaque monkey's brain (inferior temporal region I think...the "What is it?" zone of the visual stream). The monkey was presented with known and unknown visual patterns on a screen.
Known patterns would cause patterns of spiking that would last long after the visual pattern was turned off. Unknown patterns (ones the monkey had not been trained with) caused a little activity that quickly died away.
Amit believes this to be evidence of recurrent modules in the brain (groups of cells much more tightly connected with each other than the rest of the brain) in which recurrent connections keep the module spiking long after any recognized input is presented.
Ummm...that's roughly it...now go read the paper.
I'm not sure how something of this complexity can be used for games or if anyone has ever tried.
-Alex
Hello I'm looking for some source code in c or c++ of recurrent neural net but there are some with very complicated functions. I'd ask someone for a link width a source code in c/c++ with simple functions like this:
the problem is that it has an overflow error. Can someone tell me waht is wrong?
Thanks.
//---------------------------------------------------------------------------
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
//---------------------------------------------------------------------------
typedef double real;
real u,x0,x,y,d;
real wxu,wxx,wyx;
real thx,thy;
real netx,nety;
real sigy;
real P1,P2,P3;
real a;
real in[3] ={0.0,0.5,1.0};
real out[3]={0.5,1.0,0.0};
//---------------------------------------------------------------------------
// entr -0.5 y 0.5
inline real rand_e()
{
real a = (real)rand() / RAND_MAX;
real b = 2.0 * a;
real c = b - 1.0;
real d = c * 0.5;
return d;
}
inline real g(real net){ return (net); }
inline real g1(real y){ return (1.0); }
inline real f(real net){ return (1.0/(1.0+exp(-net))); }
inline real f1(real y){ return (y*(1.0-y)); }
inline real E(){ return (0.5*(d-y)*(d-y)); }
void rnn_init()
{
x0 = 0.0;
P1 = 0.0;
P2 = 0.0;
P3 = 0.0;
a = 0.5;
wxu = rand_e();
wxx = rand_e();
thx = rand_e();
wyx = rand_e();
thy = rand_e();
}
void rnn_forward()
{
netx = wxu * u + wxx * x0 - thx;
x = f(netx);
nety = wyx * x - thy;
y = g(nety);
}
void rnn_backward()
{
sigy = a * (d-y) * g1(nety);
P1 = f1(netx) * (wxx * P1 - 1.0);
thx += sigy * (wyx * P1);
P2 = f1(netx) * (wxx * P2 + u);
wxu += sigy * (wyx * P2);
P3 = f1(netx) * (wxx * P3 + x0);
wxx += sigy * (wyx * P3);
thy += sigy * (-1.0);
wyx += sigy * (x);
x0 = x;
}
//---------------------------------------------------------------------------
int main(void)
{
srand((unsigned) time(NULL));
rnn_init();
real se;
do
{
se = 0.0;
for (int i=0;i<3;i++)
{
u = in;
d = out;
rnn_forward();
real e = E();
printf("wxu: %.10f\n",wxu);
printf("wxx: %.10f\n",wxx);
printf("wyx: %.10f\n",wyx);
printf("thx: %.10f\n",thx);
printf("thy: %.10f\n",thy);
printf("P1: %.10f\n",P1);
printf("P2: %.10f\n",P2);
printf("P3: %.10f\n",P3);
printf("E: %.10f\n",e);
se += e;
rnn_backward();
}
se /= 3.0;
}
while (se > 0.0001);
system("PAUSE");
return 0;
}
the problem is that it has an overflow error. Can someone tell me waht is wrong?
Thanks.
//---------------------------------------------------------------------------
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
//---------------------------------------------------------------------------
typedef double real;
real u,x0,x,y,d;
real wxu,wxx,wyx;
real thx,thy;
real netx,nety;
real sigy;
real P1,P2,P3;
real a;
real in[3] ={0.0,0.5,1.0};
real out[3]={0.5,1.0,0.0};
//---------------------------------------------------------------------------
// entr -0.5 y 0.5
inline real rand_e()
{
real a = (real)rand() / RAND_MAX;
real b = 2.0 * a;
real c = b - 1.0;
real d = c * 0.5;
return d;
}
inline real g(real net){ return (net); }
inline real g1(real y){ return (1.0); }
inline real f(real net){ return (1.0/(1.0+exp(-net))); }
inline real f1(real y){ return (y*(1.0-y)); }
inline real E(){ return (0.5*(d-y)*(d-y)); }
void rnn_init()
{
x0 = 0.0;
P1 = 0.0;
P2 = 0.0;
P3 = 0.0;
a = 0.5;
wxu = rand_e();
wxx = rand_e();
thx = rand_e();
wyx = rand_e();
thy = rand_e();
}
void rnn_forward()
{
netx = wxu * u + wxx * x0 - thx;
x = f(netx);
nety = wyx * x - thy;
y = g(nety);
}
void rnn_backward()
{
sigy = a * (d-y) * g1(nety);
P1 = f1(netx) * (wxx * P1 - 1.0);
thx += sigy * (wyx * P1);
P2 = f1(netx) * (wxx * P2 + u);
wxu += sigy * (wyx * P2);
P3 = f1(netx) * (wxx * P3 + x0);
wxx += sigy * (wyx * P3);
thy += sigy * (-1.0);
wyx += sigy * (x);
x0 = x;
}
//---------------------------------------------------------------------------
int main(void)
{
srand((unsigned) time(NULL));
rnn_init();
real se;
do
{
se = 0.0;
for (int i=0;i<3;i++)
{
u = in;
d = out;
rnn_forward();
real e = E();
printf("wxu: %.10f\n",wxu);
printf("wxx: %.10f\n",wxx);
printf("wyx: %.10f\n",wyx);
printf("thx: %.10f\n",thx);
printf("thy: %.10f\n",thy);
printf("P1: %.10f\n",P1);
printf("P2: %.10f\n",P2);
printf("P3: %.10f\n",P3);
printf("E: %.10f\n",e);
se += e;
rnn_backward();
}
se /= 3.0;
}
while (se > 0.0001);
system("PAUSE");
return 0;
}
Hello.
I've probed the solution from the url, but still overflow. The fact is that P1, P2, P3 are the parameter that produce the overflow, because begin to increase and increase. ¿Do you know what is happening?
Thanks for the answer.
I've probed the solution from the url, but still overflow. The fact is that P1, P2, P3 are the parameter that produce the overflow, because begin to increase and increase. ¿Do you know what is happening?
Thanks for the answer.
I was thinking about a neural network where every node connected to everyother node, so that you would have (n-1)! connections. That way, you don't have to worry about topology, because all connections that are bad would be eventually zero.
Right now, every input always recieves a value between 1 and zero. What does this spiking mean? Is it where the neuron is only activated when it gets input?
Right now, every input always recieves a value between 1 and zero. What does this spiking mean? Is it where the neuron is only activated when it gets input?
Here is your post again. (
Just helping, i might post about something else later.
From,
Nice coder
and
tags (without the spaces))Hello I'm looking for some source code in c or c++ of recurrent neural net but there are some with very complicated functions. I'd ask someone for a link width a source code in c/c++ with simple functions like this:the problem is that it has an overflow error. Can someone tell me waht is wrong? Thanks.//---------------------------------------------------------------------------#include <stdio.h>#include <stdlib.h>#include <math.h>//---------------------------------------------------------------------------typedef double real;real u,x0,x,y,d;real wxu,wxx,wyx;real thx,thy;real netx,nety;real sigy;real P1,P2,P3;real a;real in[3] ={0.0,0.5,1.0};real out[3]={0.5,1.0,0.0};//---------------------------------------------------------------------------// entr -0.5 y 0.5inline real rand_e(){ real a = (real)rand() / RAND_MAX; real b = 2.0 * a; real c = b - 1.0; real d = c * 0.5; return d;}inline real g(real net){ return (net); }inline real g1(real y){ return (1.0); }inline real f(real net){ return (1.0/(1.0+exp(-net))); }inline real f1(real y){ return (y*(1.0-y)); }inline real E(){ return (0.5*(d-y)*(d-y)); }void rnn_init(){ x0 = 0.0; P1 = 0.0; P2 = 0.0; P3 = 0.0; a = 0.5; wxu = rand_e(); wxx = rand_e(); thx = rand_e(); wyx = rand_e(); thy = rand_e();}void rnn_forward(){ netx = wxu * u + wxx * x0 - thx; x = f(netx); nety = wyx * x - thy; y = g(nety);}void rnn_backward(){ sigy = a * (d-y) * g1(nety); P1 = f1(netx) * (wxx * P1 - 1.0); thx += sigy * (wyx * P1); P2 = f1(netx) * (wxx * P2 + u); wxu += sigy * (wyx * P2); P3 = f1(netx) * (wxx * P3 + x0); wxx += sigy * (wyx * P3); thy += sigy * (-1.0); wyx += sigy * (x); x0 = x;}//---------------------------------------------------------------------------int main(void){ srand((unsigned) time(NULL)); rnn_init(); real se; do { se = 0.0; for (int i=0;i<3;i++) { u = in; d = out; rnn_forward(); real e = E(); printf("wxu: %.10f\n",wxu); printf("wxx: %.10f\n",wxx); printf("wyx: %.10f\n",wyx); printf("thx: %.10f\n",thx); printf("thy: %.10f\n",thy); printf("P1: %.10f\n",P1); printf("P2: %.10f\n",P2); printf("P3: %.10f\n",P3); printf("E: %.10f\n",e); se += e; rnn_backward(); } se /= 3.0; } while (se > 0.0001); system("PAUSE"); return 0;}
Just helping, i might post about something else later.
From,
Nice coder
Click here to patch the mozilla IDN exploit, or click Here then type in Network.enableidn and set its value to false. Restart the browser for the patches to work.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement