gpt4 book ai didi

c# - Windows 环境下 LSA\LSI 的随机 SVD

转载 作者:太空狗 更新时间:2023-10-29 21:45:14 25 4
gpt4 key购买 nike

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

最佳答案

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

在 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])

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

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

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

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

等等。因此,如果您需要进行调整,您会知道我的更改在哪里。

关于c# - Windows 环境下 LSA\LSI 的随机 SVD,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17007550/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com