Windows环境下LSA LSI的随机奇异值分解

本文关键字:分解 随机 环境 LSA LSI Windows | 更新日期: 2023-09-27 18:17:48

我正在做一个项目,其中包括使用潜在语义分析(LSA)。这需要使用奇异值分解(SVD),有时是在大型数据集上。是否有随机svd (rSVD)的实现可用于Windows'Visual Studio环境?我看到一个叫做redsvd的项目,但是它似乎只支持Linux。

Windows环境下LSA LSI的随机奇异值分解

ILNumerics可能有,但我没有看到他们是否做rSVD,我没有使用库的个人经验,但幸运的是它可以通过NuGet获得。

http://ilnumerics.net

以下是他们的SVD实现文档:

http://ilnumerics.net/apidoc/Index.html?topic=html/Overload_ILNumerics_ILMath_svd.htm

也有NAG,但它是付费的:http://www.nag.co.uk/numeric/numerical_libraries.asp

我也检查了redsvd,我打赌我可以为你移植到c#,或者至少让它在windows上编译。如果这些不能满足您的需求,请告诉我,我会查看端口的复杂性。

更新:

我们今晚回到家,决定试一试。这里有一个使用Visual Studio 2010让redsvd在Windows上工作的快速方法。我把它贴在github上: https://github.com/hoonto/redsvdwin

打开rsvd3。在Visual Studio中编译它,你会在Debug目录下得到一个rsvd3.exe。

运行:

C:'Users'MLM'Documents'Visual Studio 2010'Projects'redsvdwin'Debug>rsvd3.exe
usage: redsvd --input=string --output=string [options] ...
redsvd supports the following format types (one line for each row)
[format=dense] (<value>+'n)+
[format=sparse] ((colum_id:value)+'n)+
Example:
>redsvd -i imat -o omat -r 10 -f dense
compuate SVD for a dense matrix in imat and output omat.U omat.V, and omat.S
with the 10 largest eigen values/vectors
>redsvd -i imat -o omat -r 3 -f sparse -m PCA
compuate PCA for a sparse matrix in imat and output omat.PC omat.SCORE
with the 3 largest principal components
options:
  -i, --input     input file (string)
  -o, --output    output file's prefix (string)
  -r, --rank      rank       (int [=10])
  -f, --format    format type (dense|sparse) See example.  (string [=dense])
  -m, --method    method (SVD|PCA|SymEigen) (string [=SVD])

就是这样。顺便说一下,这将构建redsvdMain.cpp,如果您想要包含它的Incr文件,请排除redsvdMain.cpp并包含redsvdMainIncr.cpp。由于两者都有main,所以我只是排除了Incr版本并构建了常规版本。

此外,我在github存储库中也包含了Eigen3头文件,并将它们放在解决方案配置的附加包含中,因此您根本不需要摆弄它。

最后一件事,据我所知,Visual Studio中没有cxxabi.h这样的东西,所以我做了一些作弊,你会看到我在哪里做了修改,因为它们会被注释成这样:

//MLM: commented next 3
//...
//...
//...
//MLM: added 1
...

等等。所以,如果你需要调整,你会知道我的变化在哪里。

qr在ILNumerics中有一个重载ILMath。qr(A, outR, outE, economy),它允许执行经济规模的分解。