本文整理汇总了Python中neuron.Neuron.response方法的典型用法代码示例。如果您正苦于以下问题:Python Neuron.response方法的具体用法?Python Neuron.response怎么用?Python Neuron.response使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类neuron.Neuron
的用法示例。
在下文中一共展示了Neuron.response方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Widget
# 需要导入模块: from neuron import Neuron [as 别名]
# 或者: from neuron.Neuron import response [as 别名]
class Widget(QWidget):
def __init__(self, parent=None):
super(Widget, self).__init__(parent)
label = QLabel()
label.setText('The neuron that you will be examining will divide the objects you will show it into the ones\n' +
'that it likes and the ones it dislikes\n' +
'Let\'s assume that be recognized objects are flowers\n')
# groupbox1
groupBox1 = QGroupBox()
groupBox1.setTitle('Feature weight')
groupBox1Label1 = QLabel()
groupBox1Label1.setText('Here you enter the neuron\'s weight coefficients for the individual object features. Positve\n' +
'coefficient means approval to the attribute, and negative one will indicate that the given\n' +
'attribute should be disliked by the neuron.')
groupBox1Label2 = QLabel()
groupBox1Label2.setText('Now, enter if you want the neuron to like the flower that is:')
self.spinBoxWeightFragment = QDoubleSpinBox()
self.spinBoxWeightFragment.setValue(1.0)
self.spinBoxWeightFragment.setRange(-100.0, 100.0)
self.spinBoxWeightColorful = QDoubleSpinBox()
self.spinBoxWeightColorful.setValue(2.0)
self.spinBoxWeightColorful.setRange(-100.0, 100.0)
groupBox1HLayout = QHBoxLayout()
groupBox1HLayout.addWidget(QLabel('Fragment:'))
groupBox1HLayout.addWidget(self.spinBoxWeightFragment)
groupBox1HLayout.addWidget(QLabel('Colorful:'))
groupBox1HLayout.addWidget(self.spinBoxWeightColorful)
groupBox1VLayout = QVBoxLayout()
groupBox1VLayout.addWidget(groupBox1Label1)
groupBox1VLayout.addWidget(groupBox1Label2)
groupBox1VLayout.addLayout(groupBox1HLayout)
groupBox1.setLayout(groupBox1VLayout)
# groupbox2
groupBox2 = QGroupBox()
groupBox2.setTitle('Evaluated object')
self.spinBoxObjectFragment = QDoubleSpinBox()
self.spinBoxObjectFragment.setRange(-100.0, 100.0)
self.spinBoxObjectColorful = QDoubleSpinBox()
self.spinBoxObjectColorful.setRange(-100.0, 100.0)
groupBox2HLayout = QHBoxLayout()
groupBox2HLayout.addWidget(QLabel('Fragment'))
groupBox2HLayout.addWidget(self.spinBoxObjectFragment)
groupBox2HLayout.addWidget(QLabel('Colorful'))
groupBox2HLayout.addWidget(self.spinBoxObjectColorful)
groupBox2VLayout = QVBoxLayout()
groupBox2VLayout.addWidget(QLabel('After setting the weight, yout can perform experiments. Enter if the flower is:'))
groupBox2VLayout.addLayout(groupBox2HLayout)
groupBox2.setLayout(groupBox2VLayout)
# groupbox3
groupBox3 = QGroupBox()
groupBox3.setTitle('Neuron\'s response')
pushbuttonGroup3 = QPushButton('Recalculate!')
self.output = QLabel()
self.attitude = QLabel()
groupBox3HLayout1 = QHBoxLayout()
groupBox3HLayout1.addWidget(QLabel('The neuron\'s response value is:'))
groupBox3HLayout1.addWidget(self.output)
groupBox3HLayout2 = QHBoxLayout()
groupBox3HLayout2.addWidget(QLabel('It means that the neuron\'s attitude against the flower is:'))
groupBox3HLayout2.addWidget(self.attitude)
groupBox3HLayout2.addWidget(pushbuttonGroup3)
groupBox3VLayout = QVBoxLayout()
groupBox3VLayout.addLayout(groupBox3HLayout1)
groupBox3VLayout.addLayout(groupBox3HLayout2)
groupBox3.setLayout(groupBox3VLayout)
layout = QVBoxLayout()
layout.addWidget(label)
layout.addWidget(groupBox1)
layout.addWidget(groupBox2)
layout.addWidget(groupBox3)
self.setLayout(layout)
self.setWindowTitle('Single neuron examination (example 01a)')
self.connect(self.spinBoxWeightFragment, SIGNAL('valueChanged(double)'), self.evaluateObject)
self.connect(self.spinBoxWeightColorful, SIGNAL('valueChanged(double)'), self.evaluateObject)
self.connect(self.spinBoxObjectFragment, SIGNAL('valueChanged(double)'), self.evaluateObject)
self.connect(self.spinBoxObjectColorful, SIGNAL('valueChanged(double)'), self.evaluateObject)
self.connect(pushbuttonGroup3, SIGNAL('clicked()'), self.evaluateObject)
self.neuron = Neuron(2)
def evaluateObject(self):
self.neuron.weights[0] = self.spinBoxWeightFragment.value()
self.neuron.weights[1] = self.spinBoxWeightColorful.value()
#.........这里部分代码省略.........