Kernel Regression from Nando's Deep Learning lecture 5
- require 'torch'
- require 'gnuplot'
- local nData =
- local kWidth =
- local xTrain = torch.linspace(-, , nData)
- local yTrain = torch.pow(xTrain, )
- print(xTrain)
- print(yTrain)
- local yTrain = yTrain + torch.mul(torch.randn(nData), 0.1)
- print(yTrain)
- local function phi(x, y)
- return torch.exp(-(/kWidth)*torch.sum(torch.pow(x-y,)))
- end
- local Phi = torch.Tensor(nData, nData)
- for i = , nData do
- for j = , nData do
- Phi[i][j] = phi(xTrain[{{i}}], xTrain[{{j}}])
- end
- end
- local regularizer = torch.mul(torch.eye(nData), 0.001)
- local theta = torch.inverse((Phi:t()*Phi) + regularizer) * Phi:t() * yTrain
- local nTestData =
- local xTest = torch.linspace(-, , nTestData)
- local PhiTest = torch.Tensor(nData, nTestData)
- for i = , nData do
- for j = , nTestData do
- PhiTest[i][j] = phi(xTrain[{{i}}], xTest[{{j}}])
- end
- end
- local yPred = PhiTest:t() * theta
- gnuplot.plot({'Data', xTrain, yTrain, '+'}, {'Prediction', xTest, yPred, '-'})
Kernel Regression from Nando's Deep Learning lecture 5的更多相关文章
- Machine and Deep Learning with Python
Machine and Deep Learning with Python Education Tutorials and courses Supervised learning superstiti ...
- (转) Learning Deep Learning with Keras
Learning Deep Learning with Keras Piotr Migdał - blog Projects Articles Publications Resume About Ph ...
- 课程一(Neural Networks and Deep Learning),第二周(Basics of Neural Network programming)—— 3、Python Basics with numpy (optional)
Python Basics with numpy (optional)Welcome to your first (Optional) programming exercise of the deep ...
- Theories of Deep Learning
https://stats385.github.io/readings Lecture 1 – Deep Learning Challenge. Is There Theory? Readings D ...
- 深度学习 Deep Learning UFLDL 最新 Tutorial 学习笔记 1:Linear Regression
1 前言 Andrew Ng的UFLDL在2014年9月底更新了. 对于開始研究Deep Learning的童鞋们来说这真的是极大的好消息! 新的Tutorial相比旧的Tutorial添加了Conv ...
- 转载 Deep learning:三(Multivariance Linear Regression练习)
前言: 本文主要是来练习多变量线性回归问题(其实本文也就3个变量),参考资料见网页:http://openclassroom.stanford.edu/MainFolder/DocumentPage. ...
- Deep Learning Tutorial - Classifying MNIST digits using Logistic Regression
Deep Learning Tutorial 由 Montreal大学的LISA实验室所作,基于Theano的深度学习材料.Theano是一个python库,使得写深度模型更容易些,也可以在GPU上训 ...
- 课程一(Neural Networks and Deep Learning),第二周(Basics of Neural Network programming)—— 4、Logistic Regression with a Neural Network mindset
Logistic Regression with a Neural Network mindset Welcome to the first (required) programming exerci ...
- Kernel Methods for Deep Learning
目录 引 主要内容 与深度学习的联系 实验 Cho Y, Saul L K. Kernel Methods for Deep Learning[C]. neural information proce ...
随机推荐
- Codeforces round #353div2 C
题目来源:http://acm.hust.edu.cn/vjudge/contest/view.action?cid=117863#problem/C 题目大意:给你n个数字,代表这个人在n个银行里面 ...
- JavaScript语法支持严格模式:"use strict"
如果给JavaScript代码标志为“严格模式”,则其中运行的所有代码都必然是严格模式下的.其一:如果在语法检测时发现语法问题,则整个代码块失效,并导致一个语法异常.其二:如果在运行期出现了违反严格模 ...
- 为什么1Byte=8bit
Byte是字节的意思,而字节在早期计算机内部是用标准ASCII码来表示的根据当时情况确定至多有128种需要表示的字符(当时是IBM的标准,现在普遍是255),也就是2的7次方用二进制的0和1来表示就需 ...
- win8、win8.1官方版本、及安装密钥
云盘地址:Windows 8 简体中文专业版+核心版 MSDN 正式版(32位)http://pan.baidu.com/s/1eQgiAiQSHA1:0C4A168E37E38EFB59E88443 ...
- 关于PowerShell中的命令的别名
cmdlets的别名,有利于使用传统的cmd的方式 或者使用 bash的方式的人员,更加方便的使用使用频率较高的命令. 以下是从 别名中获取的内置的别名. PS C:\> Get-Alias * ...
- cmake编译Debug和Release
CMake 中有一个变量 CMAKE_BUILD_TYPE ,可以的取值是 Debug Release Rel WithDebInfo 和 MinSizeRel.当这个变量值为 Debug 的时候,C ...
- [科普]MinGW vs MinGW-W64及其它
转载:http://tieba.baidu.com/p/3186234212?pid=54372018139&cid=#54372018139 这里也转一下吧. 部分参照备忘录原文: bitb ...
- Mac OS X Mavericks使用手册
基本信息 作者: 施威铭研究室 出版社:清华大学出版社 ISBN:9787302386018 上架时间:2014-12-30 出版日期:2015 年1月 开本:16 版次:1-1 所属分类: 计算机 ...
- PhpForm表单相关的超全局变量操作
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- Java I/O 模型的演进
什么是同步?什么是异步?阻塞和非阻塞又有什么区别?本文先从 Unix 的 I/O 模型讲起,介绍了5种常见的 I/O 模型.而后再引出 Java 的 I/O 模型的演进过程,并用实例说明如何选择合适的 ...