UFLDL 教程学习笔记(一)
ufdl的新教程,从基础学起。第一节讲的是线性回归。主要目的是熟悉目标函数,计算梯度和优化。
按着教程写完代码后,总是编译出错,一查是mex的原因,实在不想整了。
这位博主用的是向量,比较简洁:http://blog.csdn.net/lingerlanlan/article/details/38377023
这位博主用的是循环,更好理解:http://www.cnblogs.com/william7neral/p/4448566.html
接下来是logistic regression和向量化,没什么好说的:http://blog.csdn.net/lingerlanlan/article/details/38390085
这节主要是完成liner_regression.m,包括计算目标函数f和梯度g,需要注意的是要分清变量是列向量还是行向量或是矩阵。
对matlab不太熟,所以我稍微注释了下
function [f,g] = linear_regression(theta, X,y)
%
% Arguments:
% theta - A vector containing the parameter values to optimize.列向量
% X - The examples stored in a matrix.
% X(i,j) is the i'th coordinate of the j'th example.
% y - The target value for each example. y(j) is the target for
% example j.行向量
%
%size(a,)求矩阵的行数 size(a,)求矩阵的列数,相当于length(a)
%size(a)同时求矩阵的行和列数
% m=size(X,);
m = size(X,);
n=size(X,); f=;
g=zeros(size(theta)); %
% TODO: Compute the linear regression objective by looping over the examples in X.
% Store the objective function value in 'f'.
%
% TODO: Compute the gradient of the objective with respect to theta by looping over
% the examples in X and adding up the gradient for each example. Store the
% computed gradient in 'g'. %%% YOUR CODE HERE %%%
h = theta' * X
f = (/)* (h-y)' * (h-y)
g = X * (h - y)'
UFLDL 教程学习笔记(一)的更多相关文章
- UFLDL 教程学习笔记(四)主成分分析
UFLDL(Unsupervised Feature Learning and Deep Learning)Tutorial 是由 Stanford 大学的 Andrew Ng 教授及其团队编写的一套 ...
- UFLDL 教程学习笔记(三)自编码与稀疏性
UFLDL(Unsupervised Feature Learning and Deep Learning)Tutorial 是由 Stanford 大学的 Andrew Ng 教授及其团队编写的一套 ...
- UFLDL 教程学习笔记(二)反向传导算法
UFLDL(Unsupervised Feature Learning and Deep Learning)Tutorial 是由 Stanford 大学的 Andrew Ng 教授及其团队编写的一套 ...
- UFLDL 教程学习笔记(一)神经网络
UFLDL(Unsupervised Feature Learning and Deep Learning)Tutorial 是由 Stanford 大学的 Andrew Ng 教授及其团队编写的一套 ...
- UFLDL 教程学习笔记(四)
课程地址:http://ufldl.stanford.edu/tutorial/supervised/FeatureExtractionUsingConvolution/ 在之前的练习中,图片比较小, ...
- UFLDL 教程学习笔记(三)
教程地址:http://ufldl.stanford.edu/tutorial/supervised/SoftmaxRegression/ logstic regression是二分类的问题,如果想要 ...
- UFLDL 教程学习笔记(六)主成分分析
教程:http://ufldl.stanford.edu/tutorial/supervised/MultiLayerNeuralNetworks/ 以及这篇博文,写的很清楚:http://blog. ...
- UFLDL 教程学习笔记(二)
课程链接:http://ufldl.stanford.edu/tutorial/supervised/LogisticRegression/ 这一节主要讲的是梯度的概念,在实验部分,比较之前的线性回归 ...
- UFLDL深度学习笔记 (一)反向传播与稀疏自编码
UFLDL深度学习笔记 (一)基本知识与稀疏自编码 前言 近来正在系统研究一下深度学习,作为新入门者,为了更好地理解.交流,准备把学习过程总结记录下来.最开始的规划是先学习理论推导:然后学习一两种开源 ...
随机推荐
- [转帖]ESXi、Linux、Windows获取机器序列号的方法
http://blog.51cto.com/liubin0505star/1717473 windows: wmic bios get serialnumber linux: dmidecode准确一 ...
- 安装spring-tool-suite插件
spring-tool-suite是一个非常好用的spring插件,由于eclipse是一个很简洁的IDE,因此许多插件,需要我们自己去手动下载.而Spring-tool-suite插件即是其中之一. ...
- Eclipse中项目上有小红叉,但就是找不到报错文件(总结,持续更新)
1.jdk问题解决:jdk配置参考:http://blog.csdn.net/superit401/article/details/72847110 2.build path:项目右键——Build ...
- 【刷题】LOJ 6225 「网络流 24 题」火星探险问题
题目描述 火星探险队的登陆舱将在火星表面着陆,登陆舱内有多部障碍物探测车. 登陆舱着陆后,探测车将离开登陆舱向先期到达的传送器方向移动. 探测车在移动中还必须采集岩石标本. 每一块岩石标本由最先遇到它 ...
- C++实用整数快速输入输出模板(C++)
随便写一点放在这里,以后想蛇皮卡常就很方便啦 蒟蒻太懒了,也就暂时不搞什么封namespace之类的操作了 程序结束时记得flush一下. #include<cstdio> #define ...
- 【BZOJ1797】[AHOI2009]最小割(网络流)
[BZOJ1797][AHOI2009]最小割(网络流) 题面 BZOJ 洛谷 题解 最小割的判定问题,这里就当做记结论吧.(源自\(lun\)的课件) 我们先跑一遍最小割,求出残量网络.然后把所有还 ...
- 一步步创建第一个Docker App —— 4. 部署应用
原文:https://docs.docker.com/engine/getstarted-voting-app/deploy-app/ 在这一步中,将会使用第一步提到的 docker-stack.ym ...
- C++时间标准库时间time
转自:http://www.cnblogs.com/yukaizhao/archive/2011/04/29/cpp_time_system_time.html (玉开) C++标准库中的时间需要引用 ...
- 【leetcode】 Jump Game
Given an array of non-negative integers, you are initially positioned at the first index of the arra ...
- Python正则表达式(regular expression)简介-re模块
Python正则表达式(regular expression)简介-re模块 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 就其本质而言,正则表达式(或RE模块)是一种小型的,高度 ...