Tensor Decomposition is a Feature Learning Method

There are no good python libraries for tensor analysis, see this Quora post.

TensorFlow has some basic operations on Tensors, see this introduction

I haven’t tried TensorFlow nor tensor-analysis, nor TensorLib by CMU. The last one was developped in 2009 and there is no more updates.

I used scikit-tensor to analysis a sensory bread data. The description of the data is as follows:

The data are arranged in a three-way array (10 breads × 11 attributes × 8 judges). Also available is the salt content of the ten samples. A PARAFAC model can be seen as a reasonable approximate model incorporating saliencies for each assessor, but there is no hard theory stating the nature of the data. The data are quite noisy compared to, e.g., spectral data. The data are usually centered across the sample mode before fitting the model. This centering removes the assessor specific offsets on the attribute scales. Scaling of the data is an issue where no consensus has yet been achieved.

The code is :

import logging
from scipy.io.matlab import loadmat
from sktensor import dtensor, cp_als

logging.basicConfig(level=logging.DEBUG)

mat = loadmat('brod.mat')
T = dtensor(mat['X'])

P, fit, itr, exectimes = cp_als(T, 3, init='random')
P.U[0].shape
P.U[1].shape
P.shape
# (10, 88)

This slide has a good introduction on tensors with python code. It also explains the tensor rank.

tensor1

tensor2

This formulation is very similar to sparse coding, which is a feature learning algorithm. So I think the tensor decomposition is a feature learning method.