-
Hi tensorly-community, currently I am using non_negative_parafac_hals to decompose a data tensor containing 6 samples of data arrays of the shape (140, 110). The first five samples contain pure references for one component while the sixth sample contains two overlapping components of which one is the reference component. I decompose with the rank 2 (one expected compound, one overlapping impurity in sixth sample). The output of the decomposition is correspondingly: (weights, factors) : rank-2 CPTensor of shape (140, 110, 6) While the returned weights are [1, 1], the returned factors are the expected list of length three with arrays of the shape (140, 2), (110, 2), (6, 2). So for each of the two components, traces have been calculated in all three modes. So far so good! In my dataset, I have a peculiar property with the fact, that sample 6 can be slightly offset in one dimension (the one with the length 110). When I try to correct the offset manually, I find a best case, where the integrals of the impurity (component 1) are minimal in the first five reference samples. The results of this best case is shown below together with the summed integrals (mode 3) over all runs. It can clearly be seen, that component 0 is the reference component since it is dominant in the first five runs and the summed integral over all runs is very high compared to component 1. When I shift the sixth sample away from this best case, the parafac algorithm correctly starts to overcompensate the impurity effect with the offset effect, i.e., the traces of the first mode become identical and the traces in the second mode get split corresponding to the offset (here 10 points in the x axis of the plot). The results look like this: My question arises now from the third mode: How are the components ordered in the returned factors list elements? In the above depicted case, component 1 is dominant in 5/6 runs and has a higher summed integral over all runs. Still, it is component 1 and not component 0 in the factors list elements. What is the rule in this case? If there is a specific rule for this ordering of components, I could employ it in an optimizer to automatically offset-correct sample six in an iterative fashion. Help would be very much appreciated! Thanks a lot in advance! Best |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @HaasCP
Let me know if this helps or if I missunderstood your comment. |
Beta Was this translation helpful? Give feedback.
Hi @HaasCP
Thanks for your comment. Indeed there is no particular sorting of the components estimated by a decomposition algorithms in tensorly (contrarily to SVD for instance, where they are sorted by decreasing importance).
I am unsure what you are asking for however: if you ask for a particular ordering inside the iterations of an algorithm such as ALS (
parafac
function), while this is doable I am not convinced this is a feature we desire. Unless you planned to tinker with theparafac
code, this should not be helpful to you. On the other hand, if you want to post-process the ALS output automatically (e.g. running a few iterations, shifting output, rerun ALS and so on), you can: