Tutorials
- Alternating least squares for Canonical Polyadic (CP) Decomposition
- Generate data
- Basic call to the method, specifying the data tensor and its rank
- Run again with a different initial guess, output the initial guess.
- Increase the maximium number of iterations
- Compare the two solutions
- Rerun with same initial guess
- Changing the output frequency
- Suppress all output
- Use HOSVD initial guess
- Change the order of the dimensions in CP
- Change the tolerance
- Control sign ambiguity of factor matrices
- Recommendations
- CP-APR: Alternating Poisson Regression for fitting CP to sparse count data
- Generalized CP (GCP) Tensor Decomposition
- Computing Tucker via the HOSVD
- Higher-order Singular Value Decomposition (HOSVD) and Sequentially-truncased HOSVD (ST-HOSVD)
- Simple example of usage
- Generate a core with different accuracies for different shapes
- Generate data
tensorwith core described above - Compute (full) HOSVD
- Compute low-rank HOSVD approximation
- Verbosity - Getting more or less information.
- Example 1
- Example 2
- Specify the ranks
- Specify the mode order
- Generate bigger data tensor with core described above
- ST-HOSVD compared to HOSVD
- Alternating least squares for Tucker model
- Kruskal Tensors
- Kruskal tensor format via
ktensor - Specifying weights in a
ktensor - Creating a one-dimensional
ktensor - Constituent parts of a
ktensor - Creating a
ktensorfrom its constituent parts - Creating an empty
ktensor - Use
fullorto_tensorto convert aktensorto atensor - Use
doubleto convert aktensorto a multidimensional array - Use
tendiagorsptendiagto convert aktensorto attensor - Use
ndimsandshapefor the dimensions of aktensor - Subscripted reference for a
ktensor - Subscripted assignment for a
ktensor - Using negative indexing for the last array index
- Adding and subtracting
ktensors - Basic operations with a
ktensor - Use
permuteto reorder the modes of aktensor - Use
arrangeto normalize the factors of aktensor - Use
fixsignsfor sign indeterminacies in aktensor - Use
ktensorto store the ‘skinny’ SVD of a matrix - Displaying a
ktensor
- Kruskal tensor format via
- Converting Sparse Tensors to Matrices and vice versa
- Creating an empty sptenmat
- Sparse Tensors
- Creating a
sptensor - Specifying the accumulation method for the constructor
- Creating a one-dimensional
sptensor - Creating an all-zero
sptensor - Constituent parts of a
sptensor - Creating a
sptensorfrom its constituent parts - Creating an empty
sptensor - Use
sptenrandto create a randomsptensor - Use
squeezeto remove singleton dimensions from asptensor - Use
squashto remove empty slices from asptensor - Use
fullorto_tensorto convert asptensorto a (dense)tensor - Use
to_sptensorto convert a (dense)tensorto asptensor - Use
doubleto convert asptensorto a (dense) multidimensional array - Use
findto extract nonzeros from atensorand then create asptensor - Use
ndimsandshapeto get the shape of asptensor - Use
nnzto get the number of nonzeroes of asptensor - Subscripted reference for a
sptensor - Subscripted assignment for a
sptensor - Using negative indexing for the last array index
- Use
elemfunto manipulate the nonzeros of asptensor - Basic operations (plus, minus, times, etc.) on a
sptensor - Use
permuteto reorder the modes of asptensor - Displaying a
sptensor
- Creating a
- Sum of Structured Tensors
- Creating sumtensors
- A Magnitude Example
- Further examples of the sumtensor constructor
- Ndims and shape for dimensions of a sumtensor
- Use full to convert sumtensor to a dense tensor
- Use double to convert to a numpy array
- Matricized Khatri-Rao product of a sumtensor
- Innerproducts of sumtensors
- Norm compatibility interface
- Use CP-ALS with sumtensor
- Addition with sumtensors
- Accessing sumtensor parts
- Converting a
tensorto a 2D numpy array and vice versa- Creating a
tenmat(tensoras 2D numpy array) object - Creating a
tenmatby specifying the dimensions mapped to the rows - Creating a
tenmatby specifying the dimensions mapped to the columns - Vectorize via
tenmat - Alternative ordering for the columns for mode-\(n\) matricization
- Constituent parts of a
tenmat - Creating a
tenmatfrom its constituent parts - Creating an empty
tenmat - Use
doubleto convert atenmatto a 2D numpy array - Use
to_tensorto convert atenmatto atensor - Use
shapeandtshapefor the dimensions of a tenmat - Subscripted reference for a
tenmat - Subscripted assignment for a
tenmat - Using negative indexing for the last array index
- Basic operations for
tenmat - Multiplying two
tenmats - Displaying a
tenmat
- Creating a
- Tensors
- Creating a
tensorfrom an array - Creating a one-dimensional
tensor - Specifying trailing singleton dimensions in a
tensor - The constitutent parts of a
tensor - Creating a
tensorfrom its constituent parts - Creating an empty
tensor - Use
tenonesto create atensorof all ones - Use
tenzerosto create atensorof all zeros - Use
tenrandto create a randomtensor - Use
squeezeto remove singleton dimensions from atensor - Use
doubleto convert atensorto a (multidimensional) array - Use
ndimsandshapeto get the shape of atensor - Subscripted reference for a
tensor - Subscripted assignment for a `tensor
- Using negative indexing for the last array index
- Use
findfor subscripts of nonzero elements of atensor - Computing the Frobenius norm of a
tensor - Using
reshapeto rearrange elements in atensor - Basic operations (plus, minus, and, or, etc.) on a
tensor - Using
tt_tenfunfor elementwise operations on one or moretensors - Use
permuteto reorder the modes of atensor - Symmetrizing and checking for symmetry in a
tensor - Displaying a
tensor
- Creating a
- Tucker Tensors
- Creating a
ttensorwith atensorcore - Creating a one-dimensional
ttensor - Constituent parts of a
ttensor - Creating a
ttensorfrom its constituent parts - Creating an empty
ttensor - Use
fullorto_tensorto convert attensorto atensor - Use
reconstructto compute part of a fulltensor - Use
doubleto convert attensorto a (multidimensional) array - Use
ndimsandshapeto get the shape of attensor - Subscripted reference for a
ttensor - Subscripted assignment for a
ttensor - Using negative indexing for the last array index
- Basic operations (uplus, uminus, mtimes, etc.) on a
ttensor - Use
permuteto reorder the modes of attensor - Displaying a
ttensor - Partial Reconstruction of a Tucker Tensor
- Creating a