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的更多相关文章

  1. Machine and Deep Learning with Python

    Machine and Deep Learning with Python Education Tutorials and courses Supervised learning superstiti ...

  2. (转) Learning Deep Learning with Keras

    Learning Deep Learning with Keras Piotr Migdał - blog Projects Articles Publications Resume About Ph ...

  3. 课程一(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 ...

  4. Theories of Deep Learning

    https://stats385.github.io/readings Lecture 1 – Deep Learning Challenge. Is There Theory? Readings D ...

  5. 深度学习 Deep Learning UFLDL 最新 Tutorial 学习笔记 1:Linear Regression

    1 前言 Andrew Ng的UFLDL在2014年9月底更新了. 对于開始研究Deep Learning的童鞋们来说这真的是极大的好消息! 新的Tutorial相比旧的Tutorial添加了Conv ...

  6. 转载 Deep learning:三(Multivariance Linear Regression练习)

    前言: 本文主要是来练习多变量线性回归问题(其实本文也就3个变量),参考资料见网页:http://openclassroom.stanford.edu/MainFolder/DocumentPage. ...

  7. Deep Learning Tutorial - Classifying MNIST digits using Logistic Regression

    Deep Learning Tutorial 由 Montreal大学的LISA实验室所作,基于Theano的深度学习材料.Theano是一个python库,使得写深度模型更容易些,也可以在GPU上训 ...

  8. 课程一(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 ...

  9. Kernel Methods for Deep Learning

    目录 引 主要内容 与深度学习的联系 实验 Cho Y, Saul L K. Kernel Methods for Deep Learning[C]. neural information proce ...

随机推荐

  1. 在msvc中使用Boost.Spirit.X3

    Preface “Examples of designs that meet most of the criteria for "goodness" (easy to unders ...

  2. 使用ES6进行开发的思考

    ECMAScript6已经于近日进入了RC阶段,而早在其处于社区讨论时,我就开始一直在尝试使用ES6进行开发的方案.在Babel推出后,基于ES6的开发也有了具体可执行的解决方案,无论是Build还是 ...

  3. linux下snprintf和sprinf很少被提及的区别

    函数原型:int snprintf(char *dest, size_t size, const char *fmt, ...);函数说明: snprintf函数中的第二个参数,size的解释:siz ...

  4. Xming + PuTTY 在Windows下远程Linux主机

    Xming + PuTTY 在Windows下远程Linux主机 一.原理     Linux/Unix的X Window具有网络透明性.X Window系统里有一个统一的Server来负责各个程序与 ...

  5. Mac OS X Mavericks使用手册

    基本信息 作者: 施威铭研究室 出版社:清华大学出版社 ISBN:9787302386018 上架时间:2014-12-30 出版日期:2015 年1月 开本:16 版次:1-1 所属分类: 计算机 ...

  6. WiEngine+Eclipse+CDT+Sequoyah实现c++编程智能感知提示

    经过一段时间的摸索,我初步肯定自己基于WiEngine平台和C++开发跨Android/iPhone游戏的最佳(至少目前)环境为: Eclipse+CDT+Sequoyah 第一,JAVA代码调试技术 ...

  7. GBT28181中的RTP

    国标中说h264数据按照RFC3984打包,但是国标的测试工具——SPVMN,却不支持RFC3984的打包方式.无奈之下直接用RFC3550的方式打包,其实就是分包,然后加上RTP头,对于一帧的结束, ...

  8. UVa 11401 三角形的个数

    题意:由1,2,3...n组成的序列中找三个数,且以这三个数为变长能组成三角形,求这样的三角形个数. 思路:当每次输入n时重新都计算一遍会TLE...先预处理,将结果存入ans数组. 代码: #inc ...

  9. Roman to Integer && Integer to Roman 解答

    Roman Numeral Chart V:5 X:10 L:50 C:100 D:500 M:1000 规则: 1. 重复次数表示该数的倍数2. 右加左减:较大的罗马数字右边记上较小的罗马数字,表示 ...

  10. OpenStack Mixture HypervisorsDriver configure and implementation theory

    通过本文,您将可以了解在 OpenStack 中如何进行混合 Hypervisor 的配置及其实现原理的基本分析.本文主要结合作者在 Nova 中的实际开发经验对 OpenStack 中混合 Hype ...