Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Schmidhuber's neural bucket brigade
- struct Incomming {
- int n;
- int *idxArr;
- };
- struct Ctx {
- float lamda;
- float *xtm1;
- float **wtm1; // by index i index j
- float *xtm2;
- float **wtm2; // by index i index j
- Incomming **incomming; // by index j
- };
- // calc c_ij for t
- float ctm0(Ctx *ctx, int i, int j) {
- return ctx->xtm1[i]*ctx->wtm1[i][j];
- }
- // calc c_ij for t-1
- float ctm1(Ctx *ctx, int i, int j) {
- return ctx->xtm2[i]*ctx->wtm2[i][j];
- }
- float deltaW(Ctx *ctx, int i, int j) {
- float cDivSum = 0.0f;
- Incomming *incommingByJ = ctx->incomming[j];
- for( int k = 0; k < incommingByJ->n; k++ ) {
- int i2 = incommingByJ->idxArr[k];
- cDivSum += ctm1(ctx, i2, j);
- }
- float res = (ctm1(ctx, i, j) / cDivSum);
- // TODO< multiply by sum of kwins >
- res += (-ctx->lamda*ctm0(ctx, i, j));
- // TODO< add ext >
- return res;
- }
Add Comment
Please, Sign In to add comment