IT博客汇
  • 首页
  • 精华
  • 技术
  • 设计
  • 资讯
  • 扯淡
  • 权利声明
  • 登录 注册

    [原]神经元与人工神经元

    caimouse发表于 2017-03-26 09:40:45
    love 0

    生物的神经元结构如下:


    与人工神经元:


    这种现象叫做仿生学。

    可以使用代码来实现两个权值的感知机:

    w = [0, 0]
    b = 0
    
    def createDataSet():
        """
        create dataset for test
        """
        return [[(3, 3), 1], [(4, 3), 1], [(1, 1), -1]]
    
    def update(item):
        """
        update with stochastic gradient descent
        """
        global w, b
        w[0] += item[1] * item[0][0]
        w[1] += item[1] * item[0][1]
        b += item[1]
    
    def cal(item):
        """
        calculate the functional distance between 'item' an the dicision surface. output yi(w*xi+b).
        """
        res = 0
        for i in range(len(item[0])):
            res += item[0][i] * w[i]
        res += b
        res *= item[1]
        return res
    
    
    def check(training_set):
        """
        check if the hyperplane can classify the examples correctly
        """
        flag = False
        for item in training_set:
            if cal(item) <= 0:
                flag = True
                update(item)
        if not flag:
            print("RESULT: w: " + str(w) + " b: " + str(b))
        return flag
    
    if __name__ == "__main__":
        training_set = createDataSet()
        while check(training_set):
            pass
    

    1. TensorFlow API攻略

    http://edu.csdn.net/course/detail/4495
    2. TensorFlow入门基本教程
    http://edu.csdn.net/course/detail/4369

    3. C++标准模板库从入门到精通 

    http://edu.csdn.net/course/detail/3324

    4.跟老菜鸟学C++

    http://edu.csdn.net/course/detail/2901

    5. 跟老菜鸟学python

    http://edu.csdn.net/course/detail/2592

    6. 在VC2015里学会使用tinyxml库

    http://edu.csdn.net/course/detail/2590

    7. 在Windows下SVN的版本管理与实战 

     http://edu.csdn.net/course/detail/2579

    8.Visual Studio 2015开发C++程序的基本使用 

    http://edu.csdn.net/course/detail/2570

    9.在VC2015里使用protobuf协议

    http://edu.csdn.net/course/detail/2582

    10.在VC2015里学会使用MySQL数据库

    http://edu.csdn.net/course/detail/2672

    http://www.cnblogs.com/subconscious/p/5058741.html



沪ICP备19023445号-2号
友情链接