tensorly.kruskal_tensor
.kruskal_to_unfolded
-
kruskal_to_unfolded
(factors, mode)[source] Turns the khatri-product of matrices into an unfolded tensor
turnsfactors = [|U_1, ... U_n|]
into a mode-mode unfolding of the tensorParameters: factors : ndarray list
list of matrices, all with the same number of columns ie for all u in factor_matrices: u[i] has shape (s_u_i, R), where R is fixed
mode: int
mode of the desired unfolding
Returns: ndarray
unfolded tensor of shape (tensor_shape[mode], -1)
Notes
Writing factors = [U_1, …, U_n], we exploit the fact that
U_k = U[k].dot(khatri_rao(U_1, ..., U_k-1, U_k+1, ..., U_n))