神经网络如何模拟任意函数?
2021-08-04 本文已影响0人
ddup
概述
神经网络之所以强大,在于它强大的模拟能力。理论上,它可以以无限小的误差模拟任意函数。
也就是说,我们可以利用神经网络构建任意函数,得到任意算法。
我们这里使用一些可视化的样例,帮助大家获得一些直观的理解。
一元函数的模拟
直线
这个是最简单的情况,我们使用一个不带激活函数的神经元即可模拟。


通过调整参数,即可模拟任意直线。
阶跃函数Step Function

我们使用一个带Sigmoid激活函数的神经元来模拟。

随着参数继续增大,神经网络就会逐步逼近该函数。
矩形脉冲函数

我们分成几步来模拟:
- 使用1个神经元来模拟函数的左半部分。


- 使用1个神经元来模拟函数的右半部分(上下颠倒)。


- 再使用一个神经元将前2步的图像进行合成


得到的结果很好地近似了目标函数。
其它一元函数
利用矩形脉冲函数,我们很容易近似其它任意函数,就像积分原理一样。

二元函数的模拟
平面
这个是最简单的情况,我们使用一个不带激活函数的神经元即可模拟。


通过调整参数,即可模拟任意平面。
二元阶跃函数Step Function

我们使用一个带Sigmoid激活函数的神经元来模拟。

二元矩形脉冲函数

与一元函数的情况类似,我们分步实现它:
- 使用一个神经元来模拟函数的一个边缘


- 然后我们可以得到以下函数:

- 最后,可以合成以下函数

最终的神经网络结构如下图所示:

其它二元函数
利用二元矩形脉冲函数,我们很容易近似其它任意二元函数,就像积分原理一样。
n元函数的模拟
原理一样,自己想象!😥
问题
我们已经拥有了数字电路以及软件程序算法,为什么还需要神经网络?
构建与数字电路之上的软件程序也可以模拟任意函数,那为什么还要发明人工神经网络呢?
参考软件
更多内容及可交互版本,请参考App:
