您的位置:首页 > 编程语言

two_layer_net 代码学习笔记

2018-03-29 23:32 381 查看
1e-8 = 0.00000001


print(np.maximum(1e-8, 0 ))
1e-08


np.max:(a, axis=None, out=None, keepdims=False)
求序列的最值
最少接收一个参数
axis:默认为列向(也即 axis=0),axis = 1 时为行方向的最值;
np.maximum:(X, Y, out=None)
X 与 Y 逐位比较取其大者;
最少接收两个参数
np.max([-2, -1, 0, 1, 3])
3
np.maximum([-1, -1, 0, 1, 2], 0)
array([0, 0, 0, 1, 2])


Implementing a Neural Network
神经网络的实现
In this exercise we will develop a neural network with fully-connected layers to perform classification, and test it out on the CIFAR-10 dataset.
在这个练习中我们将建立一个神经网络完全连接的层进行分类,并测试它的cifar-10数据集。
A bit of setup
一点设置
for auto-reloading external modules
用于自动加载外部模块
returns relative error
回报率的相对误差
invalid syntax
无效语法


np.random.seed(0)
当我们设置相同的seed,每次生成的随机数相同。
如果不设置seed,则每次会生成不同的随机数


numpy.random.randn(d0, d1, …, dn)是从标准正态分布中返回一个或多个样本值。
numpy.random.rand(d0, d1, …, dn)的随机样本位于[0, 1)中。


周四看到这里,周五继续。

Forward pass: compute scores

Open the file cs231n/classifiers/neural_net.py and look at the method TwoLayerNet.loss. This function is very similar to the loss functions you have written for the SVM and Softmax exercises: It takes the data and weights and computes the class scores, the loss, and the gradients on the parameters.

Implement the first part of the forward pass which uses the weights and biases to compute the scores for all inputs.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: