本文整理汇总了Python中neuron.Neuron.memoryTraceStrength方法的典型用法代码示例。如果您正苦于以下问题:Python Neuron.memoryTraceStrength方法的具体用法?Python Neuron.memoryTraceStrength怎么用?Python Neuron.memoryTraceStrength使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类neuron.Neuron
的用法示例。
在下文中一共展示了Neuron.memoryTraceStrength方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Widget
# 需要导入模块: from neuron import Neuron [as 别名]
# 或者: from neuron.Neuron import memoryTraceStrength [as 别名]
#.........这里部分代码省略.........
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()
signals = [self.spinBoxObjectFragment.value(), self.spinBoxObjectColorful.value()]
response = self.neuron.response(signals)
strength = self.neuron.memoryTraceStrength(Neuron.StrenghtNormManhattan)
attitude = ''
palette = QPalette()
if abs(response) < 0.2 * strength:
print 'response ', response, '\t0.2 * strength ', 0.2 * strength, '\tstrenght ', strength, '\tindiffrent'
attitude = 'indiffrent'
palette.setColor(QPalette.WindowText, Qt.darkCyan)
elif response < 0:
print 'responce ', response, '\tstrength ', strength, '\tnegative'
attitude = 'negative'
palette.setColor(QPalette.WindowText, Qt.blue)
else:
print 'responce ', response, '\tstrength ', strength, '\tpositive'
attitude = 'positive'
palette.setColor(QPalette.WindowText, Qt.red)
self.output.setText(str(response))
self.attitude.setText(attitude)
self.attitude.setPalette(palette)