50a48e6cdd5f2240d2f0c793b3b3991d09c28d03,genome_handler.py,GenomeHandler,mutate,#GenomeHandler#,53

Before Change


                    range_index = new_index % self.dense_layer_size
                    choice_range = self.dense_layer_shape[range_index]
                    genome[index] = np.random.choice(choice_range)
                    break
            else:
                genome[index] = np.random.choice(self.optimizer.keys())
                break
        return genome

After Change


        self.dense_layer_size = len(self.dense_layer_shape)

    def mutate(self, genome):
        num_mutations = np.random.choice(range(3))
        for i in range(num_mutations):
            index = np.random.choice(range(1, len(genome)))
            if index < self.convolution_layer_size * self.convolution_layers:
                if genome[index - index % self.convolution_layer_size]:
                    range_index = index % self.convolution_layer_size
                    choice_range = self.convolutional_layer_shape[range_index]
                    genome[index] = np.random.choice(choice_range)
            elif index != len(genome) - 1:
                offset = self.convolution_layer_size * self.convolution_layers
                new_index = (index - offset)
                present_index = new_index - new_index % self.dense_layer_size
                if genome[present_index + offset]:
                    range_index = new_index % self.dense_layer_size
                    choice_range = self.dense_layer_shape[range_index]
                    genome[index] = np.random.choice(choice_range)
            else:
                genome[index] = np.random.choice(self.optimizer.keys()) 
        return genome

    def decode(self, genome):
        model = Sequential()
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: joeddav/devol
Commit Name: 50a48e6cdd5f2240d2f0c793b3b3991d09c28d03
Time: 2017-03-25
Author: easton.huch@gmail.com
File Name: genome_handler.py
Class Name: GenomeHandler
Method Name: mutate


Project Name: HsinYingLee/DRIT
Commit Name: 8776ca2dcfa98412a6dafc33d360ee1ba0d1b551
Time: 2018-07-25
Author: james371507@gmail.com
File Name: src/test.py
Class Name:
Method Name: main


Project Name: lcswillems/torch-rl
Commit Name: 68ec284dd57ba00230c6c6199cbb71d53e0696fc
Time: 2019-12-25
Author: maximechevalierb@gmail.com
File Name: scripts/visualize.py
Class Name:
Method Name: