Ejemplo n.º 1
0
 /**
  * Learning of all internal receptive field with given
  * predictor input vector and scalar output result
  */
 inline void learning(const InputVector& input, 
     scalar output)
 {
     std::cout << "========== LEARN " << input.transpose() << " " << output << std::endl; //TODO
     //Forward learnign to all receptive fields
     scalar maxWeight = 0.0;
     for (size_t i=0;i<_receptiveFields.size();i++) {
         scalar weight = _receptiveFields[i].activationWeight(input);
         std::cout << "=== Learn " << i << " with " << weight << std::endl; //TODO
         _receptiveFields[i].learning(input, output, weight);
         if (weight > maxWeight) {
             maxWeight = weight;
         }
     }
     //Create new receptive field if no one have been 
     //activated more than a threshold
     if (maxWeight < _weightGen) {
         _receptiveFields.push_back(ReceptiveField<inputDim, scalar>(
             _forgettingRate, _penaltyShape, 
             _gradientLearningRate, input, _shapeInit));
     }
 }