Windows环境下LSA\LSI的随机SVD

Lee*_*eor 6 c# svd lsa

我正在开展一个包括使用潜在语义分析(LSA)的项目.这需要使用奇异值分解(SVD),有时需要使用大数据集.是否有适用于Windows\Visual Studio环境的随机SVD(rSVD)实现?我看到了一个名为redsvd的项目,但它似乎只在Linux上受支持.

hoo*_*nto 3

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/numeric_libraries.asp

我还检查了 redsvd,我打赌我可以为您将其移植到 C#,或者至少让它在 Windows 上编译。如果这些不能满足您的需求,请告诉我,我将研究该端口的复杂性。

更新:

今晚回到家,决定试一试。这是使用 Visual Studio 2010 让 redsvd 在 Windows 上运行的一种非常快速的方法。我将其发布在 github 上:

https://github.com/hoonto/redsvdwin

在 Visual Studio 中打开 rsvd3.sln,构建它,您将在 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])
Run Code Online (Sandbox Code Playgroud)

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

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

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

//MLM: commented next 3
//...
//...
//...
//MLM: added 1
...
Run Code Online (Sandbox Code Playgroud)

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