Sparse PCA: reproduction of the synthetic example
The paper:
Hui Zou, Trevor Hastie, and Robert Tibshirani,
Sparse Principal Component Analysis,
Journal of computational and Graphical Statistics, 15(2): 265-286, 2006.
Reproduction of the Synthetic Example in Section 5.2 using R programming:
library(elasticnet) ## sample version of SPCA
n =
v1 = rnorm(n,,sqrt())
v2 = rnorm(n,,sqrt())
v3 = -.*v1 + 0.925*v2 + rnorm(n)
x1 = v1 + rnorm(n)
x2 = v1 + rnorm(n)
x3 = v1 + rnorm(n)
x4 = v1 + rnorm(n) x5 = v2 + rnorm(n)
x6 = v2 + rnorm(n)
x7 = v2 + rnorm(n)
x8 = v2 + rnorm(n) x9 = v3 + rnorm(n)
x10 = v3 + rnorm(n) x = cbind(x1,x2,x3,x4,x5,x6,x7,x8,x9,x10)
x.cov = t(x) %*% x/n; head(x.cov)
a = spca(x, , type='predictor', sparse='varnum', para=c(,), lambda=)
a
## population version of SPCA
g1 = matrix(, , )
diag(g1) = g2 = matrix(, , )
diag(g2) = g3 = matrix(283.7875, , )
diag(g3) = diag(g3)+ g1g3 = matrix(-, , )
g2g3 = matrix(277.5, , ) # construct the exact covariance matrix
x.cov = matrix(, , )
x.cov[:,:] = g1
x.cov[:,:] = g2
x.cov[:,:] = g3
x.cov[:,:] = g1g3
x.cov[:,:] = t(g1g3)
x.cov[:,:] = g2g3
x.cov[:,:] = t(g2g3) b = spca(x.cov, , type='Gram', sparse='varnum', para=c(,), lambda=)
b
The results of the population version using exact covariance matrix are exactly as in the paper:
> b Call:
spca(x = x.cov, K = , para = c(, ), type = "Gram", sparse = "varnum",
lambda = ) sparse PCs
Pct. of exp. var. : 40.9 39.5
Num. of non-zero loadings :
Sparse loadings
PC1 PC2
[,] 0.0 0.5
[,] 0.0 0.5
[,] 0.0 0.5
[,] 0.0 0.5
[,] 0.5 0.0
[,] 0.5 0.0
[,] 0.5 0.0
[,] 0.5 0.0
[,] 0.0 0.0
[,] 0.0 0.0
But the sample version may randomly vary a little.
> a Call:
spca(x = x, K = , para = c(, ), type = "predictor", sparse = "varnum",
lambda = ) sparse PCs
Pct. of exp. var. : 37.9 37.6
Num. of non-zero loadings :
Sparse loadings
PC1 PC2
x1 0.000 -0.303
x2 0.000 -0.533
x3 0.000 -0.576
x4 0.000 -0.540
x5 -0.492 0.000
x6 -0.287 0.000
x7 -0.481 0.000
x8 -0.666 0.000
x9 0.000 0.000
x10 0.000 0.000
Having fun learning sparse PCA!
Sparse PCA: reproduction of the synthetic example的更多相关文章
- Deflation Methods for Sparse PCA
目录 背景 总括 Hotelling's deflation 公式 特点 Projection deflation 公式 特点 Schur complement deflation Orthogona ...
- Spectral Bounds for Sparse PCA: Exact and Greedy Algorithms[贪婪算法选特征]
目录 概括 Sparse PCA Formulation 非常普遍的问题 Optimality Conditions Eigenvalue Bounds 算法 代码 概括 这篇论文,不像以往的那些论文 ...
- Sparse PCA 稀疏主成分分析
Sparse PCA 稀疏主成分分析 2016-12-06 16:58:38 qilin2016 阅读数 15677 文章标签: 统计学习算法 更多 分类专栏: Machine Learning ...
- A direct formulation for sparse PCA using semidefinite programming
目录 背景 Sparse eigenvectors(单个向量的稀疏化) 初始问题(low-rank的思想?) 等价问题 最小化\(\lambda\) 得到下列问题(易推) 再来一个等价问题 条件放松( ...
- 主成分分析(PCA)原理总结
主成分分析(Principal components analysis,以下简称PCA)是最重要的降维方法之一.在数据压缩消除冗余和数据噪音消除等领域都有广泛的应用.一般我们提到降维最容易想到的算法就 ...
- Python机器学习笔记 使用scikit-learn工具进行PCA降维
之前总结过关于PCA的知识:深入学习主成分分析(PCA)算法原理.这里打算再写一篇笔记,总结一下如何使用scikit-learn工具来进行PCA降维. 在数据处理中,经常会遇到特征维度比样本数量多得多 ...
- 深入学习主成分分析(PCA)算法原理(Python实现)
一:引入问题 首先看一个表格,下表是某些学生的语文,数学,物理,化学成绩统计: 首先,假设这些科目成绩不相关,也就是说某一科目考多少分与其他科目没有关系,那么如何判断三个学生的优秀程度呢?首先我们一眼 ...
- Sparse Principal Component Analysis
目录 背景: 部分符号 创新点 文章梗概 The LASSO AND THE ELASTIC NET 将PCA改造为回归问题 定理二 单个向量(无需进行SVD版本) 定理三 多个向量(无需进行SVD, ...
- Full Regularization Path for Sparse Principal Component Analysis
目录 背景 Notation Sparse PCA Semidefinite Relaxation Low Rank Optimization Sorting and Thresholding 背景 ...
随机推荐
- vue --》组件的封装 及 参数的传递
vue组件的定义 ● 组件(Component)是Vue.js最强大的功能之一 ● 组件可以扩展HTML元素,封装可重用代码 ● 在较高层面上,组件是自定义元素,Vue.js的编译器为他添加特殊功能 ...
- xmake v2.1.5版本新特性介绍
2.1.5版本现已进入收尾阶段,此版本加入了一大波新特性,目前正在进行稳定性测试和修复,在这里,先来介绍下新版本中引入了哪些新特性和改进. 1. 提供类似cmake的find_*系列接口,实现各种查找 ...
- MSF——客户端渗透之VBScript感染
弱点扫描 根据信息收集的结果搜索漏洞利用模块 结合外部漏洞扫描系统对大IP地址段进行批量扫描 误报率.漏报率 VNC密码破解 客户端渗透 VBScript感染方式 利用 宏 感染word.exce ...
- windows 使用nginx
windows 安装nginx 进入此地址进行下载 http://nginx.org/en/download.html 解压到相关目录 启动 start nginx 关闭 nginx -s stop ...
- VS2010中解决Qt“Unable to find a Qt build“
转自:http://blog.sina.com.cn/s/blog_687960370101d0eu.html 三种方法: 1.在QT菜单下单击OPTION,然后单击ADD,选择QT安装路径. 2.运 ...
- 修改url,
第一种场景: 无论url怎么变,表单里面的url始终不变 http://127.0.0.1:8000/CC/indexssssssssssssssssss/ url(r'^indexsssssssss ...
- java 中的引用类型
GC基本原理 GC (Garbage Collection)的基本原理:将内存中不再被使用的对象进行回收,GC中用于回收的方法称为收集器,由于GC需要消耗一些资源和时间,Java在对对象的生命周期特征 ...
- MySQL第五天——日志
日志 log_error(错误日志) 用于记录 MySQL 运行过程中的错误信息,如,无法加载 MySQL数据库的数据文件,或权限不正确等都会被记录在此. 默认情况下,错误日志是开启的,且无法禁止. ...
- openstack stein部署手册 4. glance
# 建立数据库用户及权限 create database glance; grant all privileges on glance.* to glance@'localhost' identifi ...
- Java基础学习(3)
Java基础学习(三) Java异常 Throwable类:所有异常的祖先类 Error:虚拟机异常.内存错误.没法处理 Exception:编码.环境.用户操作输入出现问题 非检查异常(自动捕获): ...