神经网络:互动练习

In the interactive exercises below, you'll further explore the inner workings of neural networks. First, you'll see how parameter and hyperparameter changes affect the network's predictions. Then you'll use what you've learned to train a neural network to fit nonlinear data.

练习1

以下组件使用以下配置设置神经网络:

  • 输入层包含 3 个神经元0.00其值分别为0.000.00
  • 隐藏层包含4个神经元
  • 输出层(1个神经元)
  • ReLU激活函数应用于所有隐藏层节点和输出节点

查看网络的初始设置(注意:暂时不要点击▶️>|按钮),然后完成小部件下面的任务。

任务1

The values for the three input features to the neural network model are all 0.00 . Click each of the nodes in the network to see all the initialized values. Before hitting the Play ( ▶️ ) button, answer this question:

你认为会产生什么样的产出值:正值、负值还是 0?
正输出值
负输出值
输出值为 0

现在点击网络图上方的播放(▶️)按钮,观察所有隐藏层节点和输出节点的值如何变化。你上面的答案正确吗?

任务 2

在修改神经网络之前,请回答以下问题:

If you add another hidden layer to the neural network after the first hidden layer, and give this new layer 3 nodes, keeping all input and weight/bias parameters the same, which other nodes' calculations will be affected?
网络中除输入节点外的所有节点
仅第一隐藏层中的节点
仅输出节点

现在修改神经网络,添加一个包含 3 个节点的新隐藏层,如下所示:

  1. 单击文本“1 个隐藏图层”左侧的“ +”按钮,在输出图层之前添加一个新的隐藏图层。
  2. 单击新隐藏图层上方的“+”按钮两次,即可向该图层添加 2 个节点。

你上面的回答正确吗?

任务3

单击网络图第一层隐藏区域中从上往下数的第二个节点。在对网络配置进行任何更改之前,请回答以下问题:

如果更改权重 w 12 (显示在第一个输入节点 x 1下方)的值,对于某些输入值,哪些其他节点的计算可能会受到影响?
没有任何
第一隐藏层中的第二个节点、第二隐藏层中的所有节点以及输出节点。
第一隐藏层、第二隐藏层和输出层中的所有节点。

现在,点击权重 w 12的文本框(显示在第一个输入节点 x 1下方),将其值更改为5.00 ,然后按 Enter 键。观察图表的更新。

你的答案正确吗?验证答案时要小心:如果节点值没有改变,是否意味着底层计算也没有改变?

练习 2

In the Feature cross exercises in the Categorical data module , you manually constructed feature crosses to fit nonlinear data. Now, you'll see if you can build a neural network that can automatically learn how to fit nonlinear data during training.

你的任务:配置一个神经网络,使其能够将下图中的橙色点与蓝色点分开,在训练数据和测试数据上实现小于 0.2 的损失。

指示:

在下面的交互式组件中:

  1. 通过尝试以下一些配置设置来修改神经网络超参数:
    • 在网络图中,单击“隐藏图层”标题左侧的+-按钮,即可添加或删除隐藏图层。
    • 单击隐藏层列上方的+-按钮,即可向隐藏层添加或删除神经元。
    • 通过从图表上方的“学习率”下拉菜单中选择新值来更改学习率。
    • 通过从图表上方的“激活”下拉菜单中选择新值来更改激活函数。
  2. 点击图表上方的播放(▶️)按钮,使用指定的参数训练神经网络模型。
  3. 观察模型在训练过程中拟合数据的可视化效果,以及输出部分中的测试损失训练损失值。
  4. If the model does not achieve loss below 0.2 on the test and training data, click reset, and repeat steps 1–3 with a different set of configuration settings. Repeat this process until you achieve the preferred results.