ensign.cp_decomp.cp_als_nn

cp_als_nn(sptensor, rank, out_dir=None, seed=0, max_iter=100, stop_tol=1e-05, mem_limit_gb=2, output_init_guess=False, verbose=False, gen_backtrack=False)[source]

Performs a nonnegative CP decomposition using the alternating least squares (ALS) method.

Nonegativity constraints are on output factor matrices. Input tensor entries must be nonnegative. [1] [2]

Parameters
sptensorSPTensor or str

Tensor to decompose. If sptensor is of type str, it should contain a path to a directory containing an SPTensor or directly to a tensor_data.txt file.

rankint

Rank of the decomposition.

out_dirstr

Path to directory where decomposition results will be written. If not set, the decomposition will not be written to disk.

Returns
decompCPDecomp

Results of the decomposition.

Other Parameters
seedint, optional

Random seed used to initialize decomposition. Default value is 0.

max_iterint, optional

Maximum iterations before stopping decomposition. Default value is 100.

stop_tolfloat, optional

Minimum change in fit required for convergence. Default value is 1.0e-5.

mem_limit_gbint, optional

Maximum memory used during decomposition, in GiB. Default value is 2.

output_init_guessbool, optional

Write the initial guess of decomposition to out_dir/input_<mode_id>.txt Default value is False.

verbosebool, optional

Output verbose decomposition progress to out_dir/output.txt Default value is False.

gen_backtrackbool, optional

Output component-wise backtracking information to out_dir/cpd_backtrack.txt Default value is False.

Raises
Exception

If there is a problem performing the decomposition.

See also

ensign.cp_decomp.CPDecomp

CP decomposition class

ensign.sptensor.SPTensor

Sparse tensor class

References

1

Kolda, T., Bader, B., “Tensor Decompositions and Applications,” SIAM Review, 51(3), pp. 455-500, 2009.

2

Baskaran, M., Meister, B., Vasilache, N., Lethin, R., “Efficient and Scalable Computations with Sparse Tensors,” IEEE HPEC, 2012.