本文整理汇总了Python中neuron.Neuron.learn_1方法的典型用法代码示例。如果您正苦于以下问题:Python Neuron.learn_1方法的具体用法?Python Neuron.learn_1怎么用?Python Neuron.learn_1使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类neuron.Neuron
的用法示例。
在下文中一共展示了Neuron.learn_1方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_3
# 需要导入模块: from neuron import Neuron [as 别名]
# 或者: from neuron.Neuron import learn_1 [as 别名]
def test_3(steps):
weights = 1
print "Target converse {0}, {1} steps".format(weights, steps)
neuron = Neuron(weights, sigm, sigmp, error)
errors = []
for i in range(steps):
inputs = [random.random() for r in range(weights)]
target = 1.0 - inputs[0]
neuron.learn_1(inputs, target)
errors.append(neuron.last_error)
print report(errors)
示例2: test_1
# 需要导入模块: from neuron import Neuron [as 别名]
# 或者: from neuron.Neuron import learn_1 [as 别名]
def test_1(steps):
weights = 3
print "Linear combination of weights {0}, {1} steps".format(weights, steps)
neuron = Neuron(weights, sigm, sigmp, error)
errors = []
for i in range(steps):
inputs = [random.random() for r in range(weights)]
target = 2*inputs[0] + 0.3*inputs[1] - 0.7*inputs[2]
neuron.learn_1(inputs, target)
errors.append(neuron.last_error)
print report(errors)
示例3: test_5
# 需要导入模块: from neuron import Neuron [as 别名]
# 或者: from neuron.Neuron import learn_1 [as 别名]
def test_5(steps):
weights = 40
print "Target sqrt(avg) {0}, {1} steps".format(weights, steps)
neuron = Neuron(weights, sigm, sigmp, error)
errors = []
for i in range(steps):
inputs = [random.random() for r in range(weights)]
avg = sum(inputs)/len(inputs)
target = math.sqrt(avg)
neuron.learn_1(inputs, target)
errors.append(neuron.last_error)
print report(errors)
示例4: test_4
# 需要导入模块: from neuron import Neuron [as 别名]
# 或者: from neuron.Neuron import learn_1 [as 别名]
def test_4(steps):
weights = 40
print "Target max - min {0}, {1} steps".format(weights, steps)
neuron = Neuron(weights, sigm, sigmp, error)
errors = []
for i in range(steps):
inputs = [random.random() for r in range(weights)]
imax = max(inputs)
imin = min(inputs)
target = imax - imin
neuron.learn_1(inputs, target)
errors.append(neuron.last_error)
print report(errors)