Tucker Decomposition
Approximating A by a Tucker decomposition
\[\hat A = C \times_1 U \times_2 V \times_3 W\]
with multilinear rank mlrank can be computed as follows.
julia> mlrank = (5, 4, 3)
julia> tucker_res = tucker(A, mlrank)
TuckerResult{Float64, 3}
Original size: (20, 15, 10)
Core size: (5, 4, 3)
Multilinear rank: (5, 4, 3)
Compression: 12.0xThe core $C$ and the factor matrices $(U, V, W)$ of the decomposition can be accessed as follows.
core(tucker_res)
factors(tucker_res)Tucker Docs
TensorKitchen.tucker — Function
tucker(A, ranks; method = :sthosvd, kwargs...) returns a TuckerResultComputes a Tucker decomposition of A with multilinear rank ranks.
Main Options
method = :sthosvd: Sets the Tucker decomposition algorithm. Possible options are::sthosvd(default): Sequentially Truncated HOSVD. A direct one-pass decomposition, mainly used as a fast standalone Tucker approximation or as the default initializer for :hooiFast, deterministic, and usually a good initial point.:hooi: High-Order Orthogonal Iteration. Iteratively refines the Tucker factors, initialized by ST-HOSVD by default.
Extended Options
For method = :hooi:
maxiter = 50: Maximum number of HOOI iterations.tol = 1e-8: Convergence tolerance based on change in relative reconstruction error.init = :sthosvd:sthosvd: Uses ST-HOSVD to initialize the Tucker factors.TuckerResult: Uses an existing Tucker decomposition as the initial point.
Example
julia> using Random
julia> Random.seed!(0)
julia> A = randn(20, 15, 10); ranks = (5, 4, 3)
julia> res = tucker(A, ranks; verbose = false)
TuckerResult{Float64, 3}
Original size: (20, 15, 10)
Core size: (5, 4, 3)
Multilinear rank: (5, 4, 3)
Compression: 12.0x
The core tensor and factor matrices can be accessed by
core(res)
factors(res)A tensor approximation can be reconstructed by
reconstruct(res)or equivalently
reconstruct_tucker(core(res), factors(res))Notes
:sthosvdis not an iterative solver. It directly returns aTuckerResultand does not expose solver-style outputs such as iteration counts or convergence diagnostics.:hooiis the iterative refinement method in the current Tucker implementation.- Important distinction: For the current Tucker implementation, do not use
solver = :rgd,init = :auto, or manifold solvers like RGD, RCG, LBFGS, etc.
TensorKitchen.TuckerResult — Type
TuckerResult{T, N}Stores a Tucker decomposition: core tensor and factor matrices.
core::Array{T,N}— core tensorfactors::Vector{Matrix{T}}— orthonormal factor matricesprocessing_order::Vector{Int}— order modes were processedsingular_values::Vector{Vector{T}}— singular values per truncation
TensorKitchen.core — Method
core(td::TuckerResult)Return the Tucker core tensor for a Tucker result.
TensorKitchen.factors — Method
factors(td::TuckerResult)Return the Tucker factor matrices.
TensorKitchen.multilinear_rank — Method
multilinear_rank(td::TuckerResult)Return the Tucker multilinear rank tuple, i.e. the size of the core tensor.
TensorKitchen.factor_dims — Method
factor_dims(td::TuckerResult)Return the original mode dimensions represented by the Tucker factor matrices.
TensorKitchen.reconstruct — Method
reconstruct(td::TuckerResult)Reconstruct the dense tensor represented by a Tucker decomposition result.
For a Tucker result with core S and factors U_1, ..., U_d, this returns S ×_1 U_1 ×_2 U_2 ... ×_d U_d.