public GeneticAlgorithm(NeuralNetwork network, DataSet dataset, int parameterSize) { this.population = new List<Chromosome>(POPULATION_SIZE); this.random = new Random(); this.network = network; this.dataset = dataset; this.parameterSize = parameterSize; }
static void Main(string[] args) { DataSet dataset = new DataSet("dataset.txt", 2, 3); NeuralNetwork network = new NeuralNetwork(2, 8, 3); GeneticAlgorithm algorithm = new GeneticAlgorithm(network, dataset, network.NumberOfParameters); Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); IList<double> parameters = algorithm.Learn(); stopwatch.Stop(); network.Run(dataset, parameters); Write(parameters); Console.WriteLine("Time: {0}", stopwatch.Elapsed.TotalSeconds); }