def learn(self, kohonen_iterations, grossberg_iterations, learning_data):
        inputs_count = self.network.inputs_count()
        outputs_count = len(learning_data[0])
        input_data = DataNormalizer.normalize([[case[i] for i in range(inputs_count)] for case in learning_data])
        output_data = [[case[i] for i in range(inputs_count, outputs_count)] for case in learning_data]

        self.kohonen_learning.learn(input_data, kohonen_iterations)
        self.grossberg_layer_learning(grossberg_iterations, input_data, output_data)
 def on_runButton_clicked(self):
     error_metric = ErrorUtil.get_factor(str(self.ui.errorMetricSelector.currentText()))()
     learning_factor = float(self.ui.learningFactorValue.text())
     momentum = float(self.ui.momentumValue.text())
     learning_iterations = int(self.ui.learningIterations.text())
     bias_enabled = self.ui.biasEnabled.isChecked()
     learning = BackpropagationLearning(self.network, error_metric, learning_factor, momentum, bias_enabled)
     learning.learn(DataNormalizer.normalize(self.input_view.get_data()), learning_iterations)
     self.accept()
Exemplo n.º 3
0
    def on_runButton_clicked(self):
        if self.ui.neighbourhoodEnabled.isChecked():
            neighbourhood = NeighbourhoodUtil.get_neighbourhood(
                str(self.ui.neighbourhoodFunctionSelector.currentText()))()
            topology = TopologyUtil.get_topology(str(self.ui.topologySelector.currentText()),
                neighbourhood, int(self.ui.initialNeighbourhoodRadius.text()),
                int(self.ui.topologyRowsValue.text()), int(self.ui.topologyColsValue.text()))
        else:
            topology = NoTopology()
        self.metric = MetricUtil.get_metric(str(self.ui.metricSelector.currentText()))()
        learning_factor = LearningFactorUtil.get_factor(str(self.ui.learningFactorSelector.currentText()),
            float(self.ui.learningFactorInitialValue.text()), int(self.ui.learningIterations.text()))

        conscience_threshold =\
        float(self.ui.conscienceThresholdValue.text()) if self.ui.conscienceEnabled.isChecked() else 0
        learning_iterations = int(self.ui.learningIterations.text())
        learning = KohonenLearning(self.network_layer, topology, self.metric, learning_factor,
            conscience_threshold)
        learning.learn(DataNormalizer.normalize(self.input_view.get_data()), learning_iterations)
        self.accept()