Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@符号增加正态扰动的含义? #41

Closed
songyp0505 opened this issue May 17, 2020 · 5 comments
Closed

@符号增加正态扰动的含义? #41

songyp0505 opened this issue May 17, 2020 · 5 comments

Comments

@songyp0505
Copy link

songyp0505 commented May 17, 2020

在3-1低阶API示范中准备数据的时候有一条注释是:

@表示矩阵乘法,增加正态扰动

具体位置在3-1低阶API示范的“一、线性回归模型”的“1、准备数据”的第一段程序片的最后一行,已附上图片不知道能不能显示
20200517115005

而在tensorflow的API(matmul )中却这样写道:
Since python >= 3.5 the @ operator is supported (see PEP 465). In TensorFlow, it simply calls the tf.matmul() function, so the following lines are equivalent:

d = a @ b @ [[10], [11]]
d = tf.matmul(tf.matmul(a, b), [[10], [11]])

在网上找了一圈也没找到关于“矩阵相乘增加正态扰动”等之类的资料,请问增加正态扰动的含义是什么呢或者说是在什么地方用到呢?是与变量X = tf.random.uniform([n,2],minval=-10,maxval=10)此处的random有关吗还是其他?谢谢!!

@nbwuzhe
Copy link
Collaborator

nbwuzhe commented May 17, 2020

This means noise with normal distribution, which refers to the second term tf.random.normal.

@songyp0505
Copy link
Author

那增加正态扰动的意思,是为了让随机数“更随机”?,但即使@符号与tf.random.normal不在一起也能影响到tf.random.normal吗还是说@符号会影响整条语句? 谢谢!

@nbwuzhe
Copy link
Collaborator

nbwuzhe commented May 17, 2020

X@w0 means matrix multiplication between X and w0. The @ mark has a higher priority than adding. b0 is a bias. This part (X@w0+b0) represents the fundamental linear operator in the neural network, which is irrelevant to the random number.

On the other hand, tf.random.normal is for adding a (pseudo-) randomized (or stochastic) noise.

@songyp0505
Copy link
Author

好的,虽然只听懂了前半部分,感觉后半部分的知识我还没接触过,日后再来请教!感谢

@nbwuzhe nbwuzhe closed this as completed May 18, 2020
@Hong-King
Copy link

我感觉作者的意思应该是:
对于【X@w0 + b0】这部分,“@”表示矩阵乘法
对于【torch.normal( 0.0,2.0,size = [n,1])】这部分,则是为了增加正态扰动

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants