tgstat
V2.3.25
tgstat
的目的是提供某些R功能(例如“ Cor”和“ Dist”)以及特定的统计工具的快速有效实现。
使用各种方法来提高性能,包括基本线性代数子程序(BLAS)库提供的优化功能的多处理和使用。
从Cran安装:
install.packages(“ TGSTAT”)
对于开发版本:
远程:: install_github(“ tanaylab/tgstat”)
图书馆(TGSTAT) set.seed(seed = 60427)行<-3000cols <-3000Vals < - sample(1:(rows * cols / 2),cols / 2),行 * cols * cols,替换= t)m < - 矩阵(vals,nrow = row = lows,ncol,ncol = ncol = ncol = cols)m_with_nas <-mm_with_nas [示例(1:(rows * cols),行 * cols / 10)] <-nadim(m)#> [1] 3000 3000
皮尔逊没有blas的相关性,没有NAS:
选项(tgs_use.blas = f) System.Time(TGS_COR(M))#>用户系统经过#> 106.865 1.951 2.331
与Blas一样:
#tgs_cor,带有blas,no nas,pearsonoptions(tgs_use.blas = t) System.Time(TGS_COR(M))#>用户系统经过#> 4.228 0.324 0.809
基本R版本:
System.Time(COR(M))#>用户系统经过#> 21.780 0.078 21.857
Pearson相关性没有Blas,与NAS:
选项(tgs_use.blas = f) system.time(tgs_cor(m_with_nas,pairwise.complete.obs = t))#>用户系统经过#> 158.846 2.687 3.164
与Blas一样:
选项(tgs_use.blas = t) system.Time(tgs_cor(m_with_nas,pairwise.complete.obs = t))#>用户系统经过#> 11.286 1.173 0.803
基本R版本:
system.Time(COR(M_WITH_NAS,use =“ pairwise.complete.obs”)#>用户系统经过#> 311.627 0.182 311.823
没有Blas的距离,没有NAS:
选项(tgs_use.blas = f) System.Time(TGS_DIST(M))#>用户系统经过#> 354.742 2.509 5.002
与Blas一样:
选项(tgs_use.blas = t) System.Time(TGS_DIST(M))#>用户系统经过#> 7.407 0.656 0.462
基础r:
System.Time(DIST(M,方法=“ Euclidean”))#>用户系统经过#> 164.197 0.077 164.280
BLAS
的说明当R与优化的BLAS实现链接时, tgstat
运行最佳。
提供了许多优化的BLAS实现,包括专有(例如Intel的MKL,Apple的Veclib)和OpenSource(例如OpenBlas,Atlas)。不幸的是,R默认情况下通常使用参考Blas实现,该实现的性能差。
让tgstat
依靠参考文献会导致非常差的性能,并且强烈灰心。如果您的R实现使用优化的BLA,请设置options(tgs_use.blas=TRUE)
以允许tgstat
进行BLAS调用。否则,设置options(tgs_use.blas=FALSE)
(默认)(默认值),该选项指示tgstat
避免使用Blas,而仅依靠其自己的优化方法。如有疑问,可以运行tgstat
CPU密集型功能之一(例如tgs_cor
),并在这两个options(tgs_use.blas=FALSE)
下比较其运行时间。
将R与优化BLAS库链接的确切说明取决于系统,并且不超出本文档的范围。