Example #1
0
 public GeneticLearner(int populationSize, int selectionSize, IModelInitializer modelInitializer, IModelExecuter modelExecuter, IPopulationBreeder populationBreeder, ThreadSafeRandom random)
 {
     this.populationSize    = populationSize;
     this.selectionSize     = selectionSize;
     this.modelInitializer  = modelInitializer;
     this.modelExecuter     = modelExecuter;
     this.populationBreeder = populationBreeder;
     this.random            = random;
     populationCostLocks    = new object[populationSize].Select(o => new object()).ToArray();
     population             = new CostModel <FullyConnectedNeuralNetworkModel> [populationSize];
 }
        public void TestInitialize()
        {
            random                    = new ThreadSafeRandom();
            modelInitializer          = new FullyConnectedNeuralNetworkInitializer(random);
            sigmoidActivationFunction = new SigmoidActivationFunction();
            modelExecuter             = new FullyConnectedNeuralNetworkExecuter(sigmoidActivationFunction);
            modelBreeder              = new GeneticModelBreeder(modelInitializer, random);
            populationBreeder         = new PolygamousPopulationBreeder(modelBreeder, random);

            sut = new GeneticLearner(populationSize, selectionSize, modelInitializer, modelExecuter, populationBreeder, random);
        }
Example #3
0
        public Experiment(
            string title,
            int iterations,
            int batchSize,
            ActivationFunction activationFunction,
            int[] activationCountsPerLayer,
            IModelExecuter executer,
            ILearner learner,
            IModelInitializer modelInitializer,
            IDataSource dataSource)
        {
            Title      = title;
            Iterations = iterations;

            this.batchSize                = batchSize;
            this.activationFunction       = activationFunction;
            this.activationCountsPerLayer = activationCountsPerLayer;
            this.executer         = executer;
            this.learner          = learner;
            this.modelInitializer = modelInitializer;
            this.dataSource       = dataSource;
            random = new Random();
        }
Example #4
0
 public BackPropagationLearner(IModelExecuter executer, [Named(nameof(SigmoidActivationFunction))] IActivationFunction sigmoidActivationFunction)
 {
     this.executer = executer;
     this.sigmoidActivationFunction = sigmoidActivationFunction;
 }