tensorly.parafac2_tensor.parafac2_to_tensor

parafac2_to_tensor(parafac2_tensor)[source]

Construct a full tensor from a PARAFAC2 decomposition.

The decomposition is on the form \((A [B_i] C)\) such that the i-th frontal slice, \(X_i\), of \(X\) is given by

\[X_i = B_i diag(a_i) C^T,\]

where \(diag(a_i)\) is the diagonal matrix whose nonzero entries are equal to the \(i\)-th row of the \(I \times R\) factor matrix \(A\), \(B_i\) is a \(J_i \times R\) factor matrix such that the cross product matrix \(B_{i_1}^T B_{i_1}\) is constant for all \(i\), and \(C\) is a \(K \times R\) factor matrix. To compute this decomposition, we reformulate the expression for \(B_i\) such that

\[B_i = P_i B,\]

where \(P_i\) is a \(J_i \times R\) orthogonal matrix and \(B\) is a \(R \times R\) matrix.

An alternative formulation of the PARAFAC2 decomposition is that the tensor element \(X_{ijk}\) is given by

\[X_{ijk} = \sum_{r=1}^R A_{ir} B_{ijr} C_{kr},\]

with the same constraints hold for \(B_i\) as above.

Parameters:
parafac2_tensorParafac2Tensor - (weight, factors, projection_matrices)
  • weights1D array of shape (rank, )

    weights of the factors

  • factorsList of factors of the PARAFAC2 decomposition

    Contains the matrices \(A\), \(B\) and \(C\) described above

  • projection_matricesList of projection matrices used to create evolving

    factors.

Returns:
ndarray

Full constructed tensor. Uneven slices are padded with zeros.