Machine learning吴恩达第二周coding作业(选做)
1.Feature Normalization:
归一化的处理
function [X_norm, mu, sigma] = featureNormalize(X)
%FEATURENORMALIZE Normalizes the features in X
% FEATURENORMALIZE(X) returns a normalized version of X where
% the mean value of each feature is 0 and the standard deviation
% is 1. This is often a good preprocessing step to do when
% working with learning algorithms. % You need to set these values correctly
X_norm = X;
mu = zeros(1, size(X, 2));
sigma = zeros(1, size(X, 2)); % ====================== YOUR CODE HERE ======================
% Instructions: First, for each feature dimension, compute the mean
% of the feature and subtract it from the dataset,
% storing the mean value in mu. Next, compute the
% standard deviation of each feature and divide
% each feature by it's standard deviation, storing
% the standard deviation in sigma.
%
% Note that X is a matrix where each column is a
% feature and each row is an example. You need
% to perform the normalization separately for
% each feature.
%
% Hint: You might find the 'mean' and 'std' functions useful.
% for i=1:size(X,2),
mu(i)=mean(X(:,i));
sigma(i)=std(X(:,i));
X_norm(:,i)=(X_norm(:,i)-mu(i))/sigma(i);
end; % ============================================================ end
2. Computing Cost (for Multiple Variables) && Gradient Descent (for Multiple Variables)
由于我们单变量的时候就是用矩阵形式处理的,所以代码与单变量相同;
3.Normal Equations
正规方程就比较简单了;
function [theta] = normalEqn(X, y)
%NORMALEQN Computes the closed-form solution to linear regression
% NORMALEQN(X,y) computes the closed-form solution to linear
% regression using the normal equations. theta = zeros(size(X, 2), 1); % ====================== YOUR CODE HERE ======================
% Instructions: Complete the code to compute the closed form solution
% to linear regression and put the result in theta.
% % ---------------------- Sample Solution ---------------------- theta=inv(X'*X)*X'*y; % ------------------------------------------------------------- % ============================================================ end
Machine learning吴恩达第二周coding作业(选做)的更多相关文章
- Machine learning 吴恩达第二周coding作业(必做题)
		1.warmUpExercise: function A = warmUpExercise() %WARMUPEXERCISE Example function in octave % A = WAR ... 
- Machine Learning——吴恩达机器学习笔记(酷
		[1] ML Introduction a. supervised learning & unsupervised learning 监督学习:从给定的训练数据集中学习出一个函数(模型参数), ... 
- Machine learning吴恩达第三周 Logistic Regression
		1. Sigmoid function function g = sigmoid(z) %SIGMOID Compute sigmoid function % g = SIGMOID(z) compu ... 
- Deap Learning (吴恩达) 第一章深度学习概论 学习笔记
		Deap Learning(Ng) 学习笔记 author: 相忠良(Zhong-Liang Xiang) start from: Sep. 8st, 2017 1 深度学习概论 打字太麻烦了,索性在 ... 
- 吴恩达机器学习笔记38-决策下一步做什么(Deciding What to Do Next Revisited)
		我们已经讨论了模型选择问题,偏差和方差的问题.那么这些诊断法则怎样帮助我们判断,哪些方法可能有助于改进学习算法的效果,而哪些可能是徒劳的呢? 让我们再次回到最开始的例子,在那里寻找答案,这就是我们之前 ... 
- Github | 吴恩达新书《Machine Learning Yearning》完整中文版开源
		最近开源了周志华老师的西瓜书<机器学习>纯手推笔记: 博士笔记 | 周志华<机器学习>手推笔记第一章思维导图 [博士笔记 | 周志华<机器学习>手推笔记第二章&qu ... 
- 我在 B 站学机器学习(Machine Learning)- 吴恩达(Andrew Ng)【中英双语】
		我在 B 站学机器学习(Machine Learning)- 吴恩达(Andrew Ng)[中英双语] 视频地址:https://www.bilibili.com/video/av9912938/ t ... 
- 【吴恩达课后编程作业】第二周作业 - Logistic回归-识别猫的图片
		1.问题描述 有209张图片作为训练集,50张图片作为测试集,图片中有的是猫的图片,有的不是.每张图片的像素大小为64*64 吴恩达并没有把原始的图片提供给我们 而是把这两个图片集转换成两个.h5文件 ... 
- 【吴恩达课后测验】Course 1 - 神经网络和深度学习 - 第二周测验【中英】
		[中英][吴恩达课后测验]Course 1 - 神经网络和深度学习 - 第二周测验 第2周测验 - 神经网络基础 神经元节点计算什么? [ ]神经元节点先计算激活函数,再计算线性函数(z = Wx + ... 
随机推荐
- QuickSort模板
			#include <iostream> using namespace std; struct node { int index; char name[20]; }; node data[ ... 
- OpenCV学习记录(一):使用haar分类器进行人脸识别                                                                                                         标签:               opencv脸部识别c++                                            2017-07-03 15:59             26人阅读
			OpenCV支持的目标检测的方法是利用样本的Haar特征进行的分类器训练,得到的级联boosted分类器(Cascade Classification).OpenCV2之后的C++接口除了Haar特征 ... 
- MapReduce的初次尝试
			====前提: 搭建好集群环境(zookeeper.hadoop.hbase). 搭建方法这里就不进行介绍了,网上有很多博客在介绍这些. ====简单需求: WordCount单词计数,号称Hadoo ... 
- [GO]gtk的windows环境搭建
			首先需要安装一个命令行的工作,我们这里安装的是msys2,直接百度地址然后安装即可,我这里安装的是64位 安装好之后进行该软件源配置 修改mirrorlist.msys ## Primary ## m ... 
- Centos7下安装与卸载Jdk1.8
			安装 去官网下载jdk:http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html 使用xs ... 
- ScreenCapturePro2 for Joomla_3.4.7-tinymce4x
			1.1. 与Joomla_3.4.7-tinymce4x整合 示例下载:Joomla_3.4.7, 1.1.1. 添加screencapture文件夹 1.1.2. 2.添加插件文件夹 路径: ... 
- 【Linux】GCC编译器
			[简介] GCC是Linux下的编译工具集,是GNU Compiler Collection的缩写,包含gcc g++ 等编译器.GCC工具集不仅能编译C/C++语言,其他例如Object-c.Pas ... 
- CodeForces 408E Curious Array(组合数学+差分)
			You've got an array consisting of n integers: a[1], a[2], ..., a[n]. Moreover, there are m queries, ... 
- Linux RPM学习笔记
			RPM(RedHat Package Manager) rp-pppoe-3.1-5.i386.rpm软件名称-版本号-编译次数-适合的硬件平台.扩展名 xxx-devel.rpm开发使用 xxx.n ... 
- 买了个vultr的vps,准备把博客转过去,顺便记录一点操作。
			1.shadow影子socks梯子已经搭好了,步骤: apt-get install python-pip pip install shadowsocks 任意目录创建配置文件json(ss可以在很多 ... 
