zoukankan      html  css  js  c++  java
  • 简单单层前馈神经网络

    代码如下
    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调用否则会报错

  • 相关阅读:
    Mysql优化之Explain查询计划查看
    map转listmap
    代码大全
    cas
    日志
    xml模板
    springboot
    日志
    spring应用
    拆分表中sheet
  • 原文地址:https://www.cnblogs.com/morvalhe/p/11508382.html
Copyright © 2011-2022 走看看