Code Duplication    Length = 18-19 lines in 2 locations

pyclustering/nnet/cnn.py 2 locations

@@ 93-111 (lines=19) @@
90
        return len(self.output);
91
92
93
    def allocate_observation_matrix(self):
94
        """!
95
        @brief Allocates observation matrix in line with output dynamic of the network.
96
        @details Matrix where state of each neuron is denoted by zero/one in line with Heaviside function on each iteration.
97
        
98
        @return (list) Observation matrix of the network dynamic.
99
        
100
        """
101
        number_neurons = len(self.output[0]);
102
        observation_matrix = [];
103
        
104
        for iteration in range(len(self.output)):
105
            obervation_column = [];
106
            for index_neuron in range(number_neurons):
107
                obervation_column.append(heaviside(self.output[iteration][index_neuron]));
108
            
109
            observation_matrix.append(obervation_column);
110
        
111
        return observation_matrix;
112
    
113
    
114
    def __allocate_neuron_patterns(self, start_iteration, stop_iteration):
@@ 114-131 (lines=18) @@
111
        return observation_matrix;
112
    
113
    
114
    def __allocate_neuron_patterns(self, start_iteration, stop_iteration):
115
        """!
116
        @brief Allocates observation transposed matrix of neurons that is limited by specified periods of simulation.
117
        @details Matrix where state of each neuron is denoted by zero/one in line with Heaviside function on each iteration.
118
        
119
        @return (list) Transposed observation matrix that is limited by specified periods of simulation.
120
        
121
        """
122
        
123
        pattern_matrix = [];
124
        for index_neuron in range(len(self.output[0])):
125
            pattern_neuron = [];
126
            for iteration in range(start_iteration, stop_iteration):
127
                pattern_neuron.append(heaviside(self.output[iteration][index_neuron]))
128
            
129
            pattern_matrix.append(pattern_neuron);
130
        
131
        return pattern_matrix;
132
    
133
    
134
    def allocate_sync_ensembles(self, steps):