Stephen Wolfram:机器学习与神经网络训练

Machine Learning, and the Training of Neural Nets 

机器学习与神经网络训练

We’ve been talking so far about neural nets that “already know” how to do particular tasks. But what makes neural nets so useful (presumably also in brains) is that not only can they in principle do all sorts of tasks, but they can be incrementally “trained from examples” to do those tasks.

我们目前为止讨论的都是那些“已经知道”如何完成特定任务的神经网络。但是,使神经网络如此有用的(也可能存在于大脑中)是它们不仅原则上可以完成各种任务,而且可以通过“示例训练”逐步学会完成这些任务。

When we make a neural net to distinguish cats from dogs we don’t effectively have to write a program that (say) explicitly finds whiskers; instead we just show lots of examples of what’s a cat and what’s a dog, and then have the network “machine learn” from these how to distinguish them.

当我们创建一个神经网络来区分猫和狗时,我们不需要编写一个(比如)明确寻找胡须的程序;相反,我们只需展示很多猫和狗的例子,然后让网络从这些例子中“机器学习”如何区分它们。

And the point is that the trained network “generalizes” from the particular examples it’s shown. Just as we’ve seen above, it isn’t simply that the network recognizes the particular pixel pattern of an example cat image it was shown; rather it’s that the neural net somehow manages to distinguish images on the basis of what we consider to be some kind of “general catness”.

关键在于,经过训练的网络会从展示的具体例子中“泛化”。正如我们上面所看到的,网络并不仅仅是识别它所展示的猫图片的特定像素模式;相反,神经网络以某种方式根据我们认为的“普遍猫性”来区分图像。

So how does neural net training actually work? Essentially what we’re always trying to do is to find weights that make the neural net successfully reproduce the examples we’ve given. And then we’re relying on the neural net to “interpolate” (or “generalize”) “between” these examples in a “reasonable” way.

那么神经网络训练实际上是如何工作的呢?本质上,我们总是试图找到让神经网络成功复制我们给出的示例的权重。然后我们依赖神经网络以一种“合理”的方式“插值”(或“泛化”)这些示例之间。

Let’s look at a problem even simpler than the nearest-point one above. Let’s just try to get a neural net to learn the function:

让我们看一个比上面的最近点问题还要简单的问题。我们只是尝试让神经网络学习这个函数:

4bdda50697098ed0a033fb57899d52b9.png

For this task, we’ll need a network that has just one input and one output, like:

为了完成这个任务,我们需要一个只有一个输入和一个输出的网络,像这样:

098c1867485e017dc8c48033b99ebb12.png

But what weights, etc. should we be using? With every possible set of weights the neural net will compute some function. And, for example, here’s what it does with a few randomly chosen sets of weights:

但是我们应该使用什么样的权重等参数呢?对于每一组可能的权重,神经网络都会计算出某个函数。例如,以下是它对几组随机选择的权重所做的操作:

0716c311c722ea9c0476ff7430033e3c.png

And, yes, we can plainly see that in none of these cases does it get even close to reproducing the function we want. So how do we find weights that will reproduce the function?

是的,我们可以明显看到,在这些情况下,它都没有接近我们想要的函数。那么我们如何找到能复现这个函数的权重呢?

The basic idea is to supply lots of “input → output” examples to “learn from”—and then to try to find weights that will reproduce these examples. Here’s the result of doing that with progressively more examples:

基本的想法是提供大量的“输入 → 输出”的例子来“学习”,然后尝试找到能复现这些例子的权重。以下是用越来越多的例子进行尝试的结果:

63722356d64fae5363aa7de11ddc4fcc.png

At each stage in this “training” the weights in the network are progressively adjusted—and we see that eventually we get a network that successfully reproduces the function we want. So how do we adjust the weights? The basic idea is at each stage to see “how far away we are” from getting the function we want—and then to update the weights in such a way as to get closer.

在这个“训练”过程的每个阶段,网络中的权重逐渐进行调整,最终我们得到了一个能够成功复现我们所需功能的网络。那么我们如何调整权重呢?基本思路是在每个阶段检查我们离获得期望的函数有多远,并以某种方式更新权重以更接近目标。

To find out “how far away we are” we compute what’s usually called a “loss function” (or sometimes “cost function”). Here we’re using a simple (L2) loss function that’s just the sum of the squares of the differences between the values we get, and the true values. And what we see is that as our training process progresses, the loss function progressively decreases (following a certain “learning curve” that’s different for different tasks)—until we reach a point where the network (at least to a good approximation) successfully reproduces the function we want:

为了找出“我们有多远”,我们通常会计算一个被称为“损失函数”(或有时叫做“成本函数”)。这里我们使用了一个简单的(L2)损失函数,它只是我们得到的值和真实值之间差的平方和。我们看到的是,随着我们的训练过程的推进,损失函数逐渐减小(遵循不同任务有不同的“学习曲线”)——直到我们达到一个网络(至少在很好的近似程度上)成功复现了我们想要的函数的点:

4298f1fda1c4a973155de000b2e1e2f8.png

Alright, so the last essential piece to explain is how the weights are adjusted to reduce the loss function. As we’ve said, the loss function gives us a “distance” between the values we’ve got, and the true values. But the “values we’ve got” are determined at each stage by the current version of neural net—and by the weights in it. But now imagine that the weights are variables—say wi. We want to find out how to adjust the values of these variables to minimize the loss that depends on them.

好的,最后一个需要解释的关键部分是如何调整权重以减小损失函数。如前所述,损失函数给我们提供了我们得到的值与真实值之间的“距离”。但是,“我们得到的值”在每个阶段都是由当前版本的神经网络及其权重决定的。现在假设权重是变量,设为 wi。我们想要找出如何调整这些变量的值以最小化依赖于它们的损失。

For example, imagine (in an incredible simplification of typical neural nets used in practice) that we have just two weights w1 and w2. Then we might have a loss that as a function of w1 and w2 looks like this:

例如,想象一下(在实际应用中对典型神经网络进行极大简化),我们只有两个权重 w1 和 w2。然后,我们可能会有一个损失函数,它作为 w1 和 w2的函数,如下所示:

200c9e1c11f42814d634e9ff52e37fc1.png

Numerical analysis provides a variety of techniques for finding the minimum in cases like this. But a typical approach is just to progressively follow the path of steepest descent from whatever previous w1, w2 we had:

数值分析提供了各种技术来寻找像这样的情况下的最小值。但是一个典型的方法就是从我们以前的 w1,w2 开始,逐步跟随最陡峭的下降路径:

aefdfc691b5d9e4f68510b8c1b9bbc96.png

Like water flowing down a mountain, all that’s guaranteed is that this procedure will end up at some local minimum of the surface (“a mountain lake”); it might well not reach the ultimate global minimum.

就像水流沿着山脉流下来,这个过程所能保证的只是它会最终到达表面的某个局部最小值(“山中湖泊”);但它可能无法达到最终的全局最小值。

It’s not obvious that it would be feasible to find the path of the steepest descent on the “weight landscape”. But calculus comes to the rescue. As we mentioned above, one can always think of a neural net as computing a mathematical function—that depends on its inputs, and its weights. But now consider differentiating with respect to these weights. It turns out that the chain rule of calculus in effect lets us “unravel” the operations done by successive layers in the neural net. And the result is that we can—at least in some local approximation—“invert” the operation of the neural net, and progressively find weights that minimize the loss associated with the output.

找到“权重景观”上最陡峭下降的路径并不明显。但微积分来解救了我们。如我们上面提到的,人们总是可以将神经网络看作计算一个数学函数——它取决于其输入和权重。但现在考虑相对于这些权重的微分。结果证明,微积分的链式法则实际上可以让我们“解开”神经网络连续层所执行的操作。结果是我们可以——至少在一些局部近似中——“反转”神经网络的操作,并逐步找到最小化与输出相关的损失的权重。

The picture above shows the kind of minimization we might need to do in the unrealistically simple case of just 2 weights. But it turns out that even with many more weights (ChatGPT uses 175 billion) it’s still possible to do the minimization, at least to some level of approximation. And in fact the big breakthrough in “deep learning” that occurred around 2011 was associated with the discovery that in some sense it can be easier to do (at least approximate) minimization when there are lots of weights involved than when there are fairly few.

上面的图片展示了我们可能需要在非常简化的情况下,仅针对两个权重进行最小化的情况。但事实证明,即使在有更多权重的情况下(ChatGPT 使用了 1750 亿个权重),仍然可以进行最小化处理,至少可以在一定程度上进行近似。事实上,大约在 2011 年发生的“深度学习”的重大突破与这样一个发现有关:在某种意义上,当涉及到大量权重时,进行(至少是近似的)最小化可能比涉及较少权重时更容易。

In other words—somewhat counterintuitively—it can be easier to solve more complicated problems with neural nets than simpler ones. And the rough reason for this seems to be that when one has a lot of “weight variables” one has a high-dimensional space with “lots of different directions” that can lead one to the minimum—whereas with fewer variables it’s easier to end up getting stuck in a local minimum (“mountain lake”) from which there’s no “direction to get out”.

换句话说,有些违反直觉的是,用神经网络解决更复杂的问题比解决更简单的问题更容易。这似乎主要是因为,当有很多“权重变量”时,人们拥有一个高维空间,其中有“很多不同的方向”可以引导人们找到最小值。而在变量较少的情况下,容易陷入局部最小值(“山间湖泊”),从那里没有“逃脱的方向”。

It’s worth pointing out that in typical cases there are many different collections of weights that will all give neural nets that have pretty much the same performance. And usually in practical neural net training there are lots of random choices made—that lead to “different-but-equivalent solutions”, like these:

值得指出的是,在典型情况下,有许多不同的权重组合,它们都可以使神经网络具有相差无几的性能。通常在实际的神经网络训练中,会进行很多随机选择,这些选择会导致“不同但等效的解决方案”,如下所示:

c5aaa34cc2aff3f8762943dce9abf32d.png

But each such “different solution” will have at least slightly different behavior. And if we ask, say, for an “extrapolation” outside the region where we gave training examples, we can get dramatically different results:

但是每一个这样的“不同解决方案”都将至少具有稍微不同的行为。如果我们要求在我们给出训练示例的区域之外进行“外推”,我们可能会得到截然不同的结果:

debf18eae56413e4cb483ed8b8bb5009.png

But which of these is “right”? There’s really no way to say. They’re all “consistent with the observed data”. But they all correspond to different “innate” ways to “think about” what to do “outside the box”. And some may seem “more reasonable” to us humans than others.

但是,这些中哪一个是“正确”的呢?实际上没有办法说清楚。它们都是“与观察到的数据一致的”。但是它们都对应了不同的“天生的”方式,来“思考”如何在“框架之外”进行操作。而其中一些可能对我们人类来说,看起来比其他的“更合理”。

1a6777bf0c660e0bb8ceccea54c20eee.jpeg

“点赞有美意,赞赏是鼓励”

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/23012.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

测试人员简单使用Jenkins

一、测试人员使用jenkins干什么? 部署测试环境 二、相关配置说明 一般由开发人员进行具体配置 1.Repository URL:填写git地址 2.填写开发分支,测试人员可通过相应分支进行测试环境的构建部署 当多个版本并行时,开发人员可以通过…

国家金融监督管理总局明确将数据安全管理纳入操作风险管理范畴

为进一步完善银行保险机构操作风险监管规则,提升银行保险机构的操作风险管理水平,国家金融监督管理总局起草了《银行保险机构操作风险管理办法(征求意见稿)》(以下简称《办法》),现向社会公开征…

【51单片机】晨启科技,7针OLED显示驱动程序,STC89C52RC

文章目录 原理图oled.coled.hmain.c 原理图 sbit OLED_SCLP4^3;//SCL-D0 sbit OLED_SDAP4^1;//SDA-D1 sbit OLED_RES P3^6;//RES sbit OLED_DC P3^7;//DC sbit OLED_CSP2^7; //CS oled.c #include "OLED.h"//******************************说明*******************…

如何维护你的电脑:打造IT人的重要武器

文章目录 方向一:介绍我的电脑方向二:介绍我的日常维护措施1. 定期清理和优化2. 保持良好的上网习惯和安全防护3. 合理安排软件和硬件的使用4. 数据备份和系统还原 方向三:推荐的维护技巧1. 数据分区和多系统安装2. 内部清洁和散热优化3. 安全…

war包方式安装linux和windows的geoserver

注意: 从Java 9开始,Oracle已经不再单独提供JRE(Java Runtime Environment)了,而是直接将JRE集成在JDK(Java Development Kit)中。这是因为JRE包含了运行Java程序所需的环境,而JDK除…

图解java.util.concurrent并发包源码系列——深入理解ReentrantLock,看完可以吊打面试官

图解java.util.concurrent并发包源码系列——深入理解ReentrantLock,看完可以吊打面试官 ReentrantLock是什么,有什么作用ReentrantLock的使用ReentrantLock源码解析ReentrantLock#lock方法FairSync#tryAcquire方法NonfairSync#tryAcquire方法 Reentrant…

CMMI评审

CMMI评审 对于刚入行的朋友来说,可能对CMMI比较陌生。但对于工作多年的朋友来说,有可能都会接触过CMMI。那CMMI到底是什么? CMMI的全称为Capability Maturity Model Integration,即能力成熟度模型集成。对于软件行业,一般是指软件能力成熟度模型集成,是由美国国防部与卡内…

(7.28-8.3)【大数据新闻速递】《数字孪生工业软件白皮书》、《中国绿色算力发展研究报告》发布;华为ChatGPT要来了

【数字孪生工业软件白皮书(2023)】 近日,第七届数字孪生与智能制造服务学术会议成功举行,2023《数字孪生工业软件白皮书》在会上正式发布。《白皮书》在《Digital Twin》国际期刊专家顾问委员会指导下,由国家重点研发计…

uC-OS2 V2.93 STM32L476 移植:环境搭建篇

前言 uC-OS2 是比较经典的 RTOS,如今软件授权已经改为 Apache License Version 2.0,意味着可以免费商用了 当前 uC-OS2 的最新版本是: V2.93,打算研究一下 RTOS 的设计思想,所以想在已有的开发板:NUCLEO-L…

棱镜七彩正式加入龙蜥社区安全联盟(OASA)

近日,龙蜥社区安全联盟(OASA)正式成立,棱镜七彩成为该联盟成员单位。 龙蜥社区安全联盟是促进产业合作的非营利组织,致力于打造中立开放、聚焦操作系统信息安全的交流平台,推进龙蜥社区乃至整个产业安全生态…

undo log、redo log和bin log

undo log 1.undo log是一种用于撤销回退的日志,MYSQL会记录更新前的数据到undo log日志文件里面,当事务回滚或者数据库崩溃时,可以用undo log进行回退 2.undo log在事务开始前产生,事务提交时并不会直接删除,而是会将…

Django 异常信息 E302 expected 2 blank lines, found 1

在Django中,PEP 8风格指南建议在任何类定义之前都应该有两个空白行,包括视图(views)。错误信息"E302 expected 2 blank lines, found 1"表示在类定义之前只有一个空白行,而Django希望有两个空白行。 要修复…

垃圾回收机制和常用的算法

一.什么是垃圾回收? 垃圾回收主要针对堆和方法区(非堆),程序计数器,虚拟机栈,本地方法栈这三个区域属于线程私有,随着线程的销毁,自然就会雄安会了,因此不需要堆着三个区域进行垃圾…

Sqlserver_Oracle_Mysql_Postgresql不同关系型数据库之主从延迟的理解和实验

关系型数据库主从节点的延迟是否和隔离级别有关联,个人认为两者没有直接关系,主从延迟在关系型数据库中一般和这两个时间有关:事务日志从主节点传输到从节点的时间事务日志在从节点的应用时间 事务日志从主节点传输到从节点的时间&#xff0…

前端-MVVM

MVVM MVVM 由以下三个内容组成 View :界⾯ Model :数据模型 ViewModel :作为桥梁负责沟通 View 和 Model 在 JQuery 时期,如果需要刷新 UI 时,需要先取到对应的 DOM 再更新UI ,这样数据和业务的逻辑就和…

sql的count函数优化

sql的count(1)函数会执行遍历表统计符合条件的数目,下面有两个sql 第一条: select count(1) from membership_call_detail_statistics a where a.repository_id f2a4ed6b3e074e33bd99998c1def26f8 and a.statistics_date between 2023-04-01 00:00:0…

Python 程序设计入门(006)—— 列表的操作(1):列表元素的增、删、改操作

Python 程序设计入门(006)—— 列表的操作(1):列表元素的增、删、改操作 目录 Python 程序设计入门(006)—— 列表的操作(1):列表元素的增、删、改操作一、创…

【MacOS】mac OS 安装HP 打印机驱动 hp laserjet m1213nf mfp

先确认一下机器复印是否正常.确认一下打印机的硬件. 如果复印没问题 1. 下载v5.1集合包Hewlett-Packard 打印机驱动程序 v5.1.1 (OS X) (中国) 2. 苹果商城中,下载Pacifist,运行Pacifist,用Pacifist程序打开v5.1并安装 3. 电脑--系统偏好设置--打印…

Kafka-副本数量设置

1. ISR副本数量设置 指的是存活的副本数量 ISR 机制的另外一个相关参数是 min.insync.replicas , 可以在 broker 或者主题级别进行配置,代表 ISR 列表中至少要有几个可用副本。这里假设设置为 2,那么当可用副本数量小于该值时,就认为整个分…

Redis BigKey案例

面试题: 阿里广告平台,海量数据里查询某一固定前缀的key小红书,你如何生产上限制keys*/flushdb/flushall等危险命令以防止误删误用?美团,MEMORY USAGE命令你用过吗?BigKey问题,多大算big&#…