文章标题:UFLDL:练习三
来源:互联网 发布:西安软件新城楼盘 编辑:程序博客网 时间:2024/05/16 15:54
1.PCA in 2D
1.1 Step 1a: Implement PCA to obtain U
u = zeros(size(x, 1)); % You need to compute thissigma = x * x' / size(x, 2);[u,s,v]=svd(sigma);
1.2 Step 1b: Compute xRot, the projection on to the eigenbasis
xRot = zeros(size(x)); % You need to compute thisxRot=u'*x;
1.3 Step 2: Reduce the number of dimensions from 2 to 1.
k = 1; % Use k = 1 and project the data onto the first eigenbasisxHat = zeros(size(x)); % You need to compute thisx_ap=u(:,1:k)'*x;xHat(1:k,:)=x_ap;xHat=u*xHat;
1.4 Step 3: PCA Whitening
xPCAWhite = zeros(size(x)); % You need to compute thisxPCAWhite = diag(1./sqrt(diag(s) + epsilon)) * u' * x;
1.5 Step 3: ZCA Whitening
xZCAWhite = zeros(size(x)); % You need to compute thisxZCAWhite=u * diag(1./sqrt(diag(s) + epsilon)) * u' * x;
2.PCA and Whitening
2.1 Step 0b: Zero-mean the data (by row)
avg = mean(x, 1);x = x - repmat(avg, size(x, 1), 1);
2.2 Step 1a: Implement PCA to obtain xRot
xRot = zeros(size(x)); % You need to compute thissigma = x * x' / size(x, 2);[U,S,V]=svd(sigma);xRot=U'*x;
2.3 Step 1b: Check your implementation of PCA
covar = zeros(size(x, 1)); % You need to compute thiscovar = xRot * xRot' / size(xRot, 2);
2.4 Step 2: Find k, the number of components to retain
k = 0; % Set k accordinglysum_k=0;sum=trace(S);for k=1:size(S,1) sum_k=sum_k+S(k,k); if(sum_k/sum>=0.99) %0.9 break; endend
2.5 Step 3: Implement PCA with dimension reduction
xHat = zeros(size(x)); % You need to compute thisxTilde = U(:,1:k)' * x;xHat(1:k,:)=xTilde;xHat=U*xHat;
2.6 Step 4a: Implement PCA with whitening and regularisation
xPCAWhite = diag(1./sqrt(diag(S) + epsilon)) * U' * x;
2.7 Step 4b: Check your implementation of PCA whitening
covar = zeros(size(xPCAWhite, 1));covar = xPCAWhite * xPCAWhite' / size(xPCAWhite, 2);
2.8 Step 5: Implement ZCA whitening
xZCAWhite=U * diag(1./sqrt(diag(S) + epsilon)) * U' * x;
0 0
- 文章标题:UFLDL:练习三
- 文章标题:UFLDL:练习一
- 文章标题:UFLDL:练习二
- 文章标题 基础练习 十六进制转八进制
- UFLDL练习(Sparse Autoencoder)
- UFLDL练习(Sparse Autoencoder)
- softmax-练习(UFLDL)
- UFLDL教程笔记及练习答案三(Softmax回归与自我学习***)
- UFLDL稀疏编码器练习实现
- UFLDL练习总结--杨炜炜.HFLS
- 【机器学习】UFLDL练习1
- 【机器学习】UFLDL练习2
- rails 练习8 --将文章标题变成连接
- 文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题
- 标题练习
- 文章标题
- 文章标题
- 文章标题
- java web 服务器推送技术--comet4j
- 单行函数和多行函数
- mac 安装 openfire
- hadoop总结
- GRE写作必备句型
- 文章标题:UFLDL:练习三
- Redis 主从 Replication 的配置
- Oracle TO_DATE 日期格式
- Mac下如何安装iterm2并使用zsh
- 浅谈Chrome V8引擎中的内存回收机制
- 中文,英文,阿拉伯数字换行排版
- Crazy Tank
- 如何用openssl命令行生成证书
- pat 1011. World Cup Betting (20)