コード例 #1
0
ファイル: LearningLauncher.py プロジェクト: Pharisaeus/Neural
 def dialog(network, learning_data):
     layers = network.get_layers()
     if Layers.get_type(layers[0]) == Layers.KOHONEN_LAYER:
         if len(layers) == 2 and Layers.get_type(layers[1]) == Layers.GENERAL_LAYER:
             return CounterPropagationLearningDialog(network)
         else:
             return KohonenLearningDialog(network)
     else:
         return BackPropagationLearningDialog(network, learning_data)
コード例 #2
0
 def _setup_network_parameters(self):
     self.ui.layerTypeSelector.addItems(Layers.layers_types())
     self.ui.layerTypeSelector.setCurrentIndex(
         self.ui.layerTypeSelector.findText(Layers.default_layer())
     )
     self.ui.layersEdit.setValue(len(self.network_model.layers()))
     for layer in self.network_model.layers():
         self.ui.layerComboBox.addItem(layer.layer_name())
     self.ui.inputNeuronsEdit.setValue(self.network_model.network_inputs())
     self.ui.neuronsEdit.setValue(self.network_model.default_layer().rowCount())
コード例 #3
0
ファイル: NetworkCreator.py プロジェクト: Pharisaeus/Neural
 def _create_layer(self, standard_layer_data):
     layer = Layers.create_layer(standard_layer_data.layer_type())
     layer_data = standard_layer_data.get_neurons_data()
     for neuron_data in layer_data:
         layer.add_neuron(Neuron(
             PSPUtil.get_psp(neuron_data[0]),
             ActivatorUtil.get_activator(neuron_data[1]),
             float(neuron_data[2]))
         )
     return layer
コード例 #4
0
ファイル: NetworkModel.py プロジェクト: Pharisaeus/Neural
 def add_layer(self):
     layer_name = self._layer_name(len(self.layers_data) + 1)
     input_neurons = self.input_neurons
     if len(self.layers_data) != 0:
         input_neurons = self.layers_data[-1].rowCount()
     layer_model = LayerModel(layer_name, Layers.default_layer(), NetworkModel.DEFAULT_NEURONS_COUNT, input_neurons,
         self.minWeight,
         self.maxWeight)
     self.layers_data.append(layer_model)
     return layer_model
コード例 #5
0
ファイル: NetworkModel.py プロジェクト: Pharisaeus/Neural
 def from_network(network):
     model = NetworkModel(empty=True)
     model.set_network_input_neurons(network.inputs_count())
     for layer in network.get_layers():
         layer_model = model.add_layer()
         neurons = layer.get_neurons()
         layer_model.set_layer_type(Layers.get_type(layer))
         layer_model.set_neurons(len(neurons))
         for neuron_index in range(len(neurons)):
             neuron = neurons[neuron_index]
             layer_model.set_psp_for_neuron(neuron_index, neuron.get_psp().NAME)
             layer_model.set_activation_for_neuron(neuron_index, neuron.get_activator().NAME)
             layer_model.set_bias_for_neuron(neuron_index, neuron.get_bias().get_weight())
             inputs = neuron.get_inputs()
             for input_index in range(len(inputs)):
                 layer_model.set_weight_for_connection(neuron_index, input_index,
                     round(neuron.get_input_edge(input_index).get_weight(), 3))
     return model