Beispiel #1
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;
 }
Beispiel #2
0
 private void InitTrainingData()
 {
     trainingdata        = new TrainingData();
     trainingdata.posvis = new double[numvisibles];
     Utility.ZeroArray(trainingdata.posvis);
     trainingdata.poshid = new double[numhiddens];
     Utility.ZeroArray(trainingdata.poshid);
     trainingdata.negvis = new double[numvisibles];
     Utility.ZeroArray(trainingdata.negvis);
     trainingdata.neghid = new double[numhiddens];
     Utility.ZeroArray(trainingdata.neghid);
 }
 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]);
     }
 }