artificial intelligence - Learning Algorithm not working? -
learning algorithm of single layer precptons works given training data, not new input.is there way correct this?
private void traning(){ while(true){ int errorcount = 0; for( int = 0 ; < input_set_count ; i++ ){ float weightsum = 0; for( int j = 0 ; j < no_input ; j++ ){ weightsum = weightsum + weight[j] * train_data[i][j]; } int toutput = 0; if( weightsum >= threshold ) toutput = 1; int error = output[i] - toutput; if( error != 0 ) errorcount++; for( int j = 0 ; j < no_input ; j++ ){ weight[j] = weight[j] + error * train_data[i][j] * learning_rate; } } if( errorcount == 0 ) break; } system.out.println("traning completed..."); }
Comments
Post a Comment