int main() { RBM *a = new RBM; //a->input(stdin); // for xor a->build(2,2); int x[2],y[2],s[2],sz[2]; x[0] = -1; x[1] = 1; y[0] = 1; y[1] = -1; s[0] = 1; s[1] = 1; sz[0] = -1; sz[1] = -1; for( int i=0; i< 100; i++) { a->train((float)1.001,2,x); a->train((float)1.001,2,y); printf( "xor %f %f same %f %f\n",a->energy(2,x),a->energy(2,y),a->energy(2,s),a->energy(2,sz)); a->dump(stdout); } s[1] = 0; a->fillin(2,s); printf("%d %d\n",s[0],s[1]); }
int main() { RBM *a = new RBM; const int code_width = 5; const int window_width = 40; FILE *ip; ip = fopen("one.10.rbm","r"); a->input(ip); fclose(ip); ip = fopen("pdbaanr","r"); fasta *d = new fasta(ip); // static issue WTF man static int encoded[window_width*code_width]; static int test[window_width*code_width]; while(d->get_next()) while( d->encode(window_width,window_width*code_width,encoded)) { int same; for( int ia=0;ia<window_width; ia++) { same = 0; for( int i=0; i< window_width*code_width; i++) test[i] = encoded[i]; for( int i=ia*code_width; i< ia*code_width+code_width; i++) test[i] = 0; // for( int i=ia*code_width; i< ia*code_width+code_width; i++) // printf("%d %d\n", encoded[i],test[i]); a->fillin(window_width*code_width, test); // for( int i=ia*code_width; i< ia*code_width+code_width; i++) // printf("%d %d\n", encoded[i],test[i]); for( int i=ia*code_width; i< ia*code_width+code_width; i++) if( test[i] == encoded[i]) same ++; printf("%d ", same); } printf("\n"); // a->train((float)1.001,window_width*code_width,encoded); } }