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.kohonenLearningFactorSelector.currentText()), float(self.ui.kohonenLearningFactorInitialValue.text()), int(self.ui.kohonenLearningIterations.text()), ) conscience_threshold = ( float(self.ui.conscienceThresholdValue.text()) if self.ui.conscienceEnabled.isChecked() else 0 ) kohonen_learning_iterations = int(self.ui.kohonenLearningIterations.text()) kohonen_learning = CounterPropagationKohonenLearning( self.network_layer, topology, self.metric, learning_factor, conscience_threshold ) learning_data = self.input_view.get_data() grossberg_learning_rule = RulesUtil.get_rule(self.ui.learningRuleSelector.currentText()) grossberg_learning_factor = LearningFactorUtil.get_factor( str(self.ui.grossbergLearningFactorSelector.currentText()), float(self.ui.grossbergLearningFactorInitialValue.text()), int(self.ui.grossbergLearningIterations.text()), ) grossberg_learning_iterations = int(self.ui.grossbergLearningIterations.text()) cp_learning = CounterPropagationLearning( self.network, grossberg_learning_rule, grossberg_learning_factor, kohonen_learning ) cp_learning.learn(kohonen_learning_iterations, grossberg_learning_iterations, learning_data) self.accept()
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()