我有一个结构与此类似的数据表。 可能有大约 10-15k 维度的堆叠维度表。每个事物大约有 10 个维度。还有一些与之相关的Y。
Names default to here(1);
ndim = 12000;
dt = new table("Example", <<ADD rows=""></ADD>
然后我将其拆分为一个几乎完全稀疏但会爆炸内存的表。
dt << Split(
Split By( :Dim ),
Split( :Y ),
Group( :Thing ),
Sort by Column Property
);
我的最终目标是在它上面做 KDTable() << K 最近的邻居。但它陷入了很多困境,因为现在的数据比原来多得多。 实际上,缺失应该被视为 0。
//this takes quite some time(in fact I've never actually finished it because I runout of memory)
mat = dt[0, [2::ncols(dt)]];
//changing the missings to zeros
mat[loc(ismissing(mat))] = 0;
kdt = KDTable(mat);
{rows, dist} = kdt << K nearest rows( {3, 2.0}, 1 );
有谁知道更好的方法来做到这一点?