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:

  1. library(elasticnet)
  2.  
  3. ## sample version of SPCA
  4. n =
  5. v1 = rnorm(n,,sqrt())
  6. v2 = rnorm(n,,sqrt())
  7. v3 = -.*v1 + 0.925*v2 + rnorm(n)
  8. x1 = v1 + rnorm(n)
  9. x2 = v1 + rnorm(n)
  10. x3 = v1 + rnorm(n)
  11. x4 = v1 + rnorm(n)
  12.  
  13. x5 = v2 + rnorm(n)
  14. x6 = v2 + rnorm(n)
  15. x7 = v2 + rnorm(n)
  16. x8 = v2 + rnorm(n)
  17.  
  18. x9 = v3 + rnorm(n)
  19. x10 = v3 + rnorm(n)
  20.  
  21. x = cbind(x1,x2,x3,x4,x5,x6,x7,x8,x9,x10)
  22. x.cov = t(x) %*% x/n; head(x.cov)
  23. a = spca(x, , type='predictor', sparse='varnum', para=c(,), lambda=)
  24. a
  25. ## population version of SPCA
  26. g1 = matrix(, , )
  27. diag(g1) =
  28.  
  29. g2 = matrix(, , )
  30. diag(g2) =
  31.  
  32. g3 = matrix(283.7875, , )
  33. diag(g3) = diag(g3)+
  34.  
  35. g1g3 = matrix(-, , )
  36. g2g3 = matrix(277.5, , )
  37.  
  38. # construct the exact covariance matrix
  39. x.cov = matrix(, , )
  40. x.cov[:,:] = g1
  41. x.cov[:,:] = g2
  42. x.cov[:,:] = g3
  43. x.cov[:,:] = g1g3
  44. x.cov[:,:] = t(g1g3)
  45. x.cov[:,:] = g2g3
  46. x.cov[:,:] = t(g2g3)
  47.  
  48. b = spca(x.cov, , type='Gram', sparse='varnum', para=c(,), lambda=)
  49. b

The results of the population version using exact covariance matrix are exactly as in the paper:

  1. > b
  2.  
  3. Call:
  4. spca(x = x.cov, K = , para = c(, ), type = "Gram", sparse = "varnum",
  5. lambda = )
  6.  
  7. sparse PCs
  8. Pct. of exp. var. : 40.9 39.5
  9. Num. of non-zero loadings :
  10. Sparse loadings
  11. PC1 PC2
  12. [,] 0.0 0.5
  13. [,] 0.0 0.5
  14. [,] 0.0 0.5
  15. [,] 0.0 0.5
  16. [,] 0.5 0.0
  17. [,] 0.5 0.0
  18. [,] 0.5 0.0
  19. [,] 0.5 0.0
  20. [,] 0.0 0.0
  21. [,] 0.0 0.0

But the sample version may randomly vary a little.

  1. > a
  2.  
  3. Call:
  4. spca(x = x, K = , para = c(, ), type = "predictor", sparse = "varnum",
  5. lambda = )
  6.  
  7. sparse PCs
  8. Pct. of exp. var. : 37.9 37.6
  9. Num. of non-zero loadings :
  10. Sparse loadings
  11. PC1 PC2
  12. x1 0.000 -0.303
  13. x2 0.000 -0.533
  14. x3 0.000 -0.576
  15. x4 0.000 -0.540
  16. x5 -0.492 0.000
  17. x6 -0.287 0.000
  18. x7 -0.481 0.000
  19. x8 -0.666 0.000
  20. x9 0.000 0.000
  21. x10 0.000 0.000

Having fun learning sparse PCA!

Sparse PCA: reproduction of the synthetic example的更多相关文章

  1. Deflation Methods for Sparse PCA

    目录 背景 总括 Hotelling's deflation 公式 特点 Projection deflation 公式 特点 Schur complement deflation Orthogona ...

  2. Spectral Bounds for Sparse PCA: Exact and Greedy Algorithms[贪婪算法选特征]

    目录 概括 Sparse PCA Formulation 非常普遍的问题 Optimality Conditions Eigenvalue Bounds 算法 代码 概括 这篇论文,不像以往的那些论文 ...

  3. Sparse PCA 稀疏主成分分析

    Sparse PCA 稀疏主成分分析 2016-12-06 16:58:38 qilin2016 阅读数 15677 文章标签: 统计学习算法 更多 分类专栏: Machine Learning   ...

  4. A direct formulation for sparse PCA using semidefinite programming

    目录 背景 Sparse eigenvectors(单个向量的稀疏化) 初始问题(low-rank的思想?) 等价问题 最小化\(\lambda\) 得到下列问题(易推) 再来一个等价问题 条件放松( ...

  5. 主成分分析(PCA)原理总结

    主成分分析(Principal components analysis,以下简称PCA)是最重要的降维方法之一.在数据压缩消除冗余和数据噪音消除等领域都有广泛的应用.一般我们提到降维最容易想到的算法就 ...

  6. Python机器学习笔记 使用scikit-learn工具进行PCA降维

    之前总结过关于PCA的知识:深入学习主成分分析(PCA)算法原理.这里打算再写一篇笔记,总结一下如何使用scikit-learn工具来进行PCA降维. 在数据处理中,经常会遇到特征维度比样本数量多得多 ...

  7. 深入学习主成分分析(PCA)算法原理(Python实现)

    一:引入问题 首先看一个表格,下表是某些学生的语文,数学,物理,化学成绩统计: 首先,假设这些科目成绩不相关,也就是说某一科目考多少分与其他科目没有关系,那么如何判断三个学生的优秀程度呢?首先我们一眼 ...

  8. Sparse Principal Component Analysis

    目录 背景: 部分符号 创新点 文章梗概 The LASSO AND THE ELASTIC NET 将PCA改造为回归问题 定理二 单个向量(无需进行SVD版本) 定理三 多个向量(无需进行SVD, ...

  9. Full Regularization Path for Sparse Principal Component Analysis

    目录 背景 Notation Sparse PCA Semidefinite Relaxation Low Rank Optimization Sorting and Thresholding 背景 ...

随机推荐

  1. js json中的时间转换格式

    //根据json中的日期格式,转换成yyyy-mm-dd HH:mm:ss function ChangeDateFormat(cellval) { var date = new Date(parse ...

  2. Error querying database. Cause: org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'ItemsCustom' in 'class com.pojo.OrderDetailCustom

    再用 junit 测试MyBatis时发现的错误: org.apache.ibatis.exceptions.PersistenceException: ### Error querying data ...

  3. Socket服务端和客户端文件传输

    很多朋友在使用socket编程时不可避免的都做过文件传输,而视频电影等需要一个字节一个字节的传输:但是客户端一般都通过-1进行终止,服务也一样:但是存在的问题是客户端永远不会把-1传递给服务端:因此经 ...

  4. Java-XML解析第一篇主流开源类库解析XML

    1.流行的XML解析框架 1>底层解析方式:存在编码复杂性.难扩展.难复用.....想了解底层解析方式请参考:浅谈 Java XML 底层解析方式 2>Dom4j:基于 JAXP 解析方式 ...

  5. QT 5.12安装

    QT 5.12为最新的LTS版本,将通过该版本开始QT的学习 1.软件下载 QT5.12下载地址:http://download.qt.io/archive/qt/5.12/ 当前最新版本为5.12. ...

  6. AcWing 802. 区间和

    (https://www.acwing.com/problem/content/804/) 假定有一个无限长的数轴,数轴上每个坐标上的数都是0. 现在,我们首先进行 n 次操作,每次操作将某一位置x上 ...

  7. 《Cascaded Pyramid Network for Multi-Person Pose Estimation》论文阅读及复现笔记

    一.PipeLine 要点 TopDown + GlobalNet + RefineNet 二.Motivation 通过提高对难以识别的关键点的识别准确率,来提升总体识别准确率. 方法:1.refi ...

  8. 工作时使用的vim配置

    """"""""""""""""&quo ...

  9. c# 实现ComboBox自动模糊匹配

    ComboBox自带有属性可以实现自动匹配,但是它有一个弊端,只能从头开始匹配,例如"李四LS",只能输入“李四”或"李"才能匹配出来,而输入"LS& ...

  10. 通过离线安装包解决了 from cryptography.hazmat.bindings._openssl import ffi, lib ImportError: /usr/local/python36/lib/python3.6/site-packages/cryptography-2.2.2-py3.6-linux-x86_64.egg/cryptography/hazmat/binding

    场景:内网服务器不能上外网(代理也不通!), 之前安装了PYTHON的几个安装包,但不是知道为什么无法使用PARAMIKO这个模块 在导入 from cryptography.hazmat.bindi ...