Exemplo n.º 1
0
 public RBM(RBMLayer PVisibles, RBMLayer PHiddens, RBMLearningRate PLearnRate, IWeightInitializer PWeightInit)
 {
     numvisibles = PVisibles.Count;
     numhiddens  = PHiddens.Count;
     InitLayers(PVisibles, PHiddens);
     InitWeights(PWeightInit);
     InitTrainingData();
     learnrate = PLearnRate;
 }
        private void PerformPreTraining(int PPreSynapticLayer)
        {
            RBMLearningRate sentlearnrate = new RBMLearningRate(learnrate.prelrweights[PPreSynapticLayer]
                                                                , learnrate.prelrbiases[PPreSynapticLayer]
                                                                , learnrate.premomweights[PPreSynapticLayer]
                                                                , learnrate.premombiases[PPreSynapticLayer]);

            RBMTrainer.Train(layers[PPreSynapticLayer], layers[PPreSynapticLayer + 1], trainingdata[PPreSynapticLayer]
                             , sentlearnrate, recognitionweights.GetWeightSet(PPreSynapticLayer));
        }
Exemplo n.º 3
0
 public RBM(RBM PA)
 {
     visibles     = (RBMLayer)PA.visibles.Clone();
     hiddens      = (RBMLayer)PA.hiddens.Clone();
     weights      = (RBMWeightSet)PA.weights.Clone();
     learnrate    = PA.learnrate;
     trainingdata = PA.trainingdata;
     numvisibles  = PA.numvisibles;
     numhiddens   = PA.numhiddens;
 }
 public static void Train(RBMLayer PLayerVis, RBMLayer PLayerHid, TrainingData PData
                          , RBMLearningRate PLearnRate, RBMWeightSet PWeightSet)
 {
     weightset = PWeightSet;
     learnrate = PLearnRate;
     for (int i = 0; i < PLayerVis.Count; i++)
     {
         for (int j = 0; j < PLayerHid.Count; j++)
         {
             TrainWeight(i, j, CalculateTrainAmount(PData.posvis[i], PData.poshid[j]
                                                    , PData.negvis[i], PData.neghid[j]));
         }
         TrainBias(PLayerVis, i, PData.posvis[i], PData.negvis[i]);
     }
     for (int j = 0; j < PLayerHid.Count; j++)
     {
         TrainBias(PLayerHid, j, PData.poshid[j], PData.neghid[j]);
     }
 }