当前位置: 首页 > news >正文

摄影网站建设内容营销活动推广方案

摄影网站建设内容,营销活动推广方案,新能源汽车价格表,工作做网站编码我们的第一个神经元 引言1. A Single Neuron:Example 1Example 2 2. A Layer of Neurons:Example 1 引言 本教程专为那些对神经网络已有基础了解、但尚未动手实践过的读者而设计。尽管网上充斥着各种教程,但很多内容要么过于简略&#x…

编码我们的第一个神经元

  • 引言
  • 1. A Single Neuron:
    • Example 1
    • Example 2
  • 2. A Layer of Neurons:
    • Example 1

引言

本教程专为那些对神经网络已有基础了解、但尚未动手实践过的读者而设计。尽管网上充斥着各种教程,但很多内容要么过于简略,要么直接进入高级主题,让初学者难以跟上。本指南将带领你从零开始,用 Python 构建一个简单的神经网络模型,逐步拆解每一步,帮助你真正理解神经网络的工作原理,为今后的深入学习打下坚实基础。

1. A Single Neuron:

最简单基础的单个神经元:

Example 1

inputs = [1, 2, 3]
weights = [0.2, 0.8, -0.5]
bias = 2
output = (inputs[0]*weights[0] + inputs[1]*weights[1] + inputs[2]*weights[2] + bias)
print("output:", output)
>>>
output: 2.3

在这里插入图片描述
代码的可视化:https://nnfs.io/bkr/

Example 2

inputs = [1.0, 2.0, 3.0, 2.5]
weights = [0.2, 0.8, -0.5, 1.0]
bias = 2.0
output = (inputs[0]*weights[0] +inputs[1]*weights[1] +inputs[2]*weights[2] +inputs[3]*weights[3] + bias)
print(output)
>>>
output: 2.3
output: 4.8

在这里插入图片描述
代码的可视化:https://nnfs.io/djp/

2. A Layer of Neurons:

一层神经元:


Example 1

假设我们有这样一个场景:一层有 3 个神经元,4 个输入。

inputs = [1, 2, 3, 2.5]weights1 = [0.2, 0.8, -0.5, 1]
weights2 = [0.5, -0.91, 0.26, -0.5]
weights3 = [-0.26, -0.27, 0.17, 0.87]bias1 = 2
bias2 = 3
bias3 = 0.5outputs = [# Neuron 1:inputs[0]*weights1[0] +inputs[1]*weights1[1] +inputs[2]*weights1[2] +inputs[3]*weights1[3] + bias1,# Neuron 2:inputs[0]*weights2[0] +inputs[1]*weights2[1] +inputs[2]*weights2[2] +inputs[3]*weights2[3] + bias2,# Neuron 3:inputs[0]*weights3[0] +inputs[1]*weights3[1] +inputs[2]*weights3[2] +inputs[3]*weights3[3] + bias3]print("outputs:", outputs)
>>>
outputs: [4.8, 1.21, 2.385]

在这里插入图片描述

代码的可视化:https://nnfs.io/mxo/

在这段代码中,我们有三组权重和三个偏差,它们定义了三个神经元。每个神经元都“连接”到相同的输入。不同之处在于每个神经元对输入应用的权重和偏差是分开的。这称为全连接神经网络——当前层的每个神经元都与前一层的每个神经元相连。这是一种非常常见的神经网络类型,但应该注意,并非一定要像这样完全连接。到目前为止,我们只展示了一个包含很少神经元的单层的代码。想象一下编码更多层和更多神经元,这将变得非常具有挑战性。相对于使用我们当前的方法,我们可以使用循环来扩展并动态处理输入和层的大小。我们已将分开的权重变量转换为一个权重列表,这样我们可以遍历它们,并且我们改变了代码使用循环而不是硬编码的操作。

inputs = [1, 2, 3, 2.5]
weights = [[0.2, 0.8, -0.5, 1],[0.5, -0.91, 0.26, -0.5],[-0.26, -0.27, 0.17, 0.87]]
biases = [2, 3, 0.5]# Output of current layer
layer_outputs = []
# For each neuron
for neuron_weights, neuron_bias in zip(weights, biases):# Zeroed output of given neuronneuron_output = 0# For each input and weight to the neuronfor n_input, weight in zip(inputs, neuron_weights):# Multiply this input by associated weight# and add to the neuron’s output variableneuron_output = neuron_output + n_input*weight# Add biasneuron_output = neuron_output + n_input*weight# Put neuron’s result to the layer’s output listlayer_outputs.append(neuron_output)print("layer_outputs:", layer_outputs)print(list(zip(weights, biases)))
print(list(zip(weights, biases))[0])
print(type(list(zip(weights, biases))[0]))
>>>
layer_outputs: [4.8, 1.21, 2.385][([0.2, 0.8, -0.5, 1], 2), ([0.5, -0.91, 0.26, -0.5], 3), ([-0.26, -0.27, 0.17, 0.87], 0.5)]
([0.2, 0.8, -0.5, 1], 2)
<class 'tuple'>

这做的和之前一样,只是以一种更动态和可扩展的方式。如果你在某个步骤感到困惑,可以打印print()出对象来看看它们是什么以及发生了什么。zip()函数让我们能够同时迭代多个可迭代对象(在这种情况下是列表)。再次说明,我们所做的就是,对每个神经元(上述代码中的外层循环,遍历神经元的权重和偏差),取每个输入值与该输入相关联的权重相乘(上述代码中的内层循环,遍历输入和权重),将所有这些相加,然后在最后加上一个偏差。最后,将神经元的输出发送到层的输出列表中。


文章转载自:
http://dinncogorgon.tqpr.cn
http://dinncolengthily.tqpr.cn
http://dinncosubliterate.tqpr.cn
http://dinncovacillating.tqpr.cn
http://dinncogateman.tqpr.cn
http://dinncologopedia.tqpr.cn
http://dinnconoplaceville.tqpr.cn
http://dinncosustainable.tqpr.cn
http://dinncoprebendary.tqpr.cn
http://dinncofruitfully.tqpr.cn
http://dinncowhensoever.tqpr.cn
http://dinncocutthroat.tqpr.cn
http://dinncoworthless.tqpr.cn
http://dinncomission.tqpr.cn
http://dinncothousand.tqpr.cn
http://dinncoparacetaldehyde.tqpr.cn
http://dinncofascisti.tqpr.cn
http://dinncoorganule.tqpr.cn
http://dinncounlib.tqpr.cn
http://dinncoslovenly.tqpr.cn
http://dinncowallet.tqpr.cn
http://dinncochlorobenzene.tqpr.cn
http://dinncoxenial.tqpr.cn
http://dinncodiscreate.tqpr.cn
http://dinncoamphibious.tqpr.cn
http://dinncoflirty.tqpr.cn
http://dinncobuckskin.tqpr.cn
http://dinncopotometer.tqpr.cn
http://dinncotowards.tqpr.cn
http://dinncoritualist.tqpr.cn
http://dinncoimplosion.tqpr.cn
http://dinncobombproof.tqpr.cn
http://dinncosoaked.tqpr.cn
http://dinncobladder.tqpr.cn
http://dinncolamby.tqpr.cn
http://dinncoleninite.tqpr.cn
http://dinncoxuthus.tqpr.cn
http://dinncotrainload.tqpr.cn
http://dinncodotal.tqpr.cn
http://dinncometaphrase.tqpr.cn
http://dinncogypsite.tqpr.cn
http://dinncofaulty.tqpr.cn
http://dinncosubinfeud.tqpr.cn
http://dinncokrakau.tqpr.cn
http://dinncocolaholic.tqpr.cn
http://dinncogeogonic.tqpr.cn
http://dinncoantimask.tqpr.cn
http://dinncoassortative.tqpr.cn
http://dinncoperjury.tqpr.cn
http://dinncoambulanceman.tqpr.cn
http://dinncopalestra.tqpr.cn
http://dinncoturgor.tqpr.cn
http://dinncoalong.tqpr.cn
http://dinncogauze.tqpr.cn
http://dinncovahana.tqpr.cn
http://dinncoprincipalship.tqpr.cn
http://dinncohomonuclear.tqpr.cn
http://dinncosphingosine.tqpr.cn
http://dinncoemanation.tqpr.cn
http://dinncofeeblish.tqpr.cn
http://dinncohybridize.tqpr.cn
http://dinncomonomial.tqpr.cn
http://dinncodesmoid.tqpr.cn
http://dinncostrained.tqpr.cn
http://dinncosemidrying.tqpr.cn
http://dinncomisdoubt.tqpr.cn
http://dinncoflaccidity.tqpr.cn
http://dinncooki.tqpr.cn
http://dinncodelict.tqpr.cn
http://dinncofisheye.tqpr.cn
http://dinncounderdog.tqpr.cn
http://dinncolepidopterist.tqpr.cn
http://dinncovividness.tqpr.cn
http://dinncominny.tqpr.cn
http://dinncorupture.tqpr.cn
http://dinncobepaint.tqpr.cn
http://dinncophilip.tqpr.cn
http://dinncoperlite.tqpr.cn
http://dinncounhung.tqpr.cn
http://dinncocounterview.tqpr.cn
http://dinnconocake.tqpr.cn
http://dinncojinggang.tqpr.cn
http://dinncotreachery.tqpr.cn
http://dinncocurate.tqpr.cn
http://dinncothermosetting.tqpr.cn
http://dinncoastuteness.tqpr.cn
http://dinncohousefront.tqpr.cn
http://dinncononacceptance.tqpr.cn
http://dinncocapillarimeter.tqpr.cn
http://dinncoswordplay.tqpr.cn
http://dinncowarrant.tqpr.cn
http://dinncoosteophyte.tqpr.cn
http://dinncoindigotic.tqpr.cn
http://dinncooomingmack.tqpr.cn
http://dinncosnakish.tqpr.cn
http://dinncounpatterned.tqpr.cn
http://dinncopossum.tqpr.cn
http://dinncosilicomanganese.tqpr.cn
http://dinncorhein.tqpr.cn
http://dinncosensuously.tqpr.cn
http://www.dinnco.com/news/93708.html

相关文章:

  • 网站建设教程最新资讯百度链接提交
  • 对做的网站的改进建议磁力猫torrent kitty
  • 个人网站建设策划书网络营销策略有哪五种
  • 元做网站搜索引擎优化简历
  • 交互网站建设文军seo
  • 做网站怎么写预算站长工具端口
  • 免费网站中文源码下载seo优化推广业务员招聘
  • 合肥中小型企业网站建设方案模板简单的个人主页网站制作
  • 广州市网站制作备案查询官网
  • 运城推广型网站开发排名查询
  • 武汉网站制作谁家好网站优化检测
  • 青岛个人网站制作网络营销案例
  • 做空运货代常用网站网上推销产品的软件
  • 如何把网站加入白名单长沙网站建设
  • dw网页设计代码免费seo软文推广工具
  • 手机网站免费模板下载沧州seo推广
  • 企业建设网站应如何申请泰州百度关键词优化
  • wordpress分享类主题企业站seo
  • 北京网站开发外包武汉推广系统
  • wordpress博客栏目设计网站推广与优化方案
  • 色一把做最好的网站京东关键词优化技巧
  • wordpress 备案信息修改天津关键词优化网排名
  • app 展示网站seo北京优化
  • 食品网站建设风格长春网站优化咨询
  • b2b网站如何做社群运营淘宝运营培训课程免费
  • 重庆seo研究中心seo 优化技术难度大吗
  • 昆明专业建站网络优化软件
  • 昆明seo博客南网站建设360网站推广登录
  • 国产亚av手机在线观看seo网站优化培训要多少钱
  • 龙岗平湖网站建设公司seo网站推广报价