实现HOSVD(高阶奇异值分解)推荐系统
https://blog.youkuaiyun.com/zd836614437/article/details/51193359
对上面文章内容用matlab实现
1、创建一个如下的张量
代码:
A(: , : ,1)=[1,0,0;1,0,0;0,0,0];
A(: , : ,2)=[0,0,0;0,1,0;0,0,0];
A(: , : ,3)=[0,0,0;0,0,0;0,0,1];
A=tensor(A)
输出:
A is a tensor of size 3 x 3 x 3
A(:,:,1) =
1 0 0
1 0 0
0 0 0
A(:,:,2) =
0 0 0
0 1 0
0 0 0
A(:,:,3) =
0 0 0
0 0 0
0 0 1
图形如下图:

2、将张量按照mode-n模展开
A1=tenmat(A,1); %模-1展开
A2=tenmat(A,2); %模-2展开
A3=tenmat(A,3); %模-3展开
输出为:
A1 is a matrix corresponding to a tensor of size 3 x 3 x 3
A1.rindices = [ 1 ] (modes of tensor corresponding to rows)
A1.cindices = [ 2 3 ] (modes of tensor corresponding to columns)
A1.data =
1 0 0 0 0 0 0 0 0
1 0 0 0

本文通过Matlab详细展示了高阶奇异值分解(HOSVD)推荐系统的实现过程,包括张量创建、模展开、奇异值分解及核心张量构建等关键步骤。
最低0.47元/天 解锁文章
5843

被折叠的 条评论
为什么被折叠?



