Neural Network archetype in C++[3]

[入库:2006年2月23日] [更新:2007年3月24日]

本文简介:

d true outputs y[] for pattern p     
//      cout << "Test Data " << p << ": ";
        for (int i=0; i<NUM_INPUT; i++){
          xt[p][i]= rand() % 2;                   
          sum+=xt[p][i];
 //         cout << xt[p][i] << ""; 
          }   
        yt[p][0]= ( sum<RULE ? UPPERBOUND: LOWERBOUND)   ;
        yt[p][1]= ( sum>=RULE ? UPPERBOUND: LOWERBOUND)   ;
//        cout << "->" << FormattedOutput(yt[p]) << "" << endl;
        }       
    cout <<"   Done!" << endl;                                                                                                      
                                       
}  

///////////////////////////////////////////////////////
    void CreateTrainingPatterns(){    
     cout <<"\nCenerating " << NUM_PATTERNS<< " training patterns...";       
        for(int p=0;p<NUM_PATTERNS;p++){  
        int sum =0;     
      // create inputs x[j] and true outputs y[] for pattern p     
    //   cout << "Pat " << p << ": ";
        for (int i=0; i<NUM_INPUT; i++){
          xp[p][i]=rand() % 2 ; 
          sum+=xp[p][i];
    //      cout << xp[p][i] << ""; 
          }   
   //   cout << "";
        yp[p][0]= ( sum<RULE ? UPPERBOUND: LOWERBOUND)   ;
        yp[p][1]= ( sum>=RULE ? UPPERBOUND: LOWERBOUND)   ;        
   //     cout << "->" << yp[p][0]<< "" << yp[p][1] << " " << endl;
      }   
     cout <<"   Done!" << endl;                                     
}
           
////////////////////////////////////////////////////////           
void Train (int number_of_pattern_used){
//    fullytrained = false;
   int times = 50;
   
   cout <<"Begin training  (epoch="<< times<<", using the first "<< number_of_pattern_used << " patterns) ... ";
   int curr_pattern_idx=0;

本文关键:Neural Network archetype in C++
  相关方案
Google
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top