Exemple #1
0
 public ConvolutionalChromosome(ConvolutionalNetwork cNet, ConvRandomParams crp, DenseRandomParams drp)
 {
     this.crp = crp;
     this.drp = drp;
     //добавить рандомные параметры
     convPart  = new ConvStructure(cNet.slidingWindows, cNet.convActivationIndexes, cNet.filters, cNet.convDropoutIndexes, cNet.convDropoutRates);
     densePart = new DenseStructure(cNet.denseActivationIndexes, cNet.neurons, cNet.denseDropoutIndexes, cNet.denseDropoutRates);
 } // конструктор для создания хромосомы из полей описательного класса ConvolutionalNetwork для последующего использования в генетических алгоритмах (например, для поиска лучшего варианта чем текущий)
Exemple #2
0
 public void MutateDense(DenseRandomParams drp, int mutateRate)
 {
     if (random.Next(100) < mutateRate)
     {
         if (random.Next(100) < 5)
         {
             densePart = new DenseStructure(nrp, drp, random);
         }
         else
         {
             densePart.MutateLayersNumb(drp, mutateRate);
             densePart.MutateActivation(drp, mutateRate);
             densePart.MutateNeurons(drp, mutateRate);
             densePart.MutateDropouts(drp, mutateRate);
         }
     }
 }
Exemple #3
0
 public ConvolutionalChromosome(GeneticProgramm gp, Random random)
 {
     _gp         = gp;
     this.random = random;
     nrp         = gp._nrp;
     crp         = gp._crp;
     drp         = gp._drp;
     convPart    = new ConvStructure(crp, random);
     densePart   = new DenseStructure(nrp, drp, random);
     if (nrp.notRandomSpeed)
     {
         trainConstSpeed = nrp.trainConstSpeedRange[0];
     }
     else
     {
         trainConstSpeed = Convert.ToSingle(random.Next((int)(nrp.trainConstSpeedRange[0] * 1000), (int)(nrp.trainConstSpeedRange[1] * 1000))) / 1000;
     }
     optimizer     = nrp.optimizers[random.Next(nrp.optimizers.Count)];
     loss_function = nrp.loss_functions[random.Next(nrp.loss_functions.Count)];
 }