morvalhe

代码如下
import numpy as np
import math
class Neuron(object):
def init(self):
self.weights=np.array([1,2,3])
self.bias=0.0
def forward(self,inputs):
cell_sum=math.fsum((inputs*self.weights)+self.bias)
result=1.0/(math.exp(-cell_sum)+1.0)
return result
neuron=Neuron()
output=neuron.forward(np.array([2.0,2.0,2.0]))
print(output)
编写了一个简单的神经元输出节点,尤其注意fsum函数是最新语法,不能再用sum调用否则会报错

分类:

技术点:

相关文章:

  • 2021-04-24
  • 2021-09-09
  • 2022-12-23
  • 2021-12-21
  • 2021-11-07
  • 2021-12-10
  • 2021-09-29
  • 2022-01-21
猜你喜欢
  • 2021-11-26
  • 2022-03-11
  • 2021-12-25
  • 2021-11-17
  • 2021-05-15
相关资源
相似解决方案