sandialabs / pyttb

Python Tensor Toolbox
https://pyttb.readthedocs.io
BSD 2-Clause "Simplified" License
25 stars 13 forks source link

Optimize only specific modes in cp_als() #302

Closed ghbrown closed 1 month ago

ghbrown commented 4 months ago

An argument called optdims of type List[int] is added to cp_als() to enable optimizing only the factor matrices of specific modes. This was not previously possible even by scripting around cp_als() since it checks for convergence only after each full sweep. Control flow was hardly altered (dimorder may now just be missing some entries), and the default is of course optimizing all modes.


📚 Documentation preview 📚: https://pyttb--302.org.readthedocs.build/en/302/

dmdunla commented 4 months ago

@ghbrown Can you please add an issue as described in the GitHub workflow in CONTRIBUTING.md? And please include a motivating use case for this so that is captured in the Issue.

tgkolda commented 4 months ago

Be careful about the convergence check which uses the last MTTKRP (at least in MATLAB) and assumes it's a particular mode that is left out.

ghbrown commented 4 months ago

Thanks for the warning, Tammy. I just looked over that part of the code, and because of where and how I updated dimorder I believe all of that should be properly taken care of automatically. But I did catch and fix a comment that needed to change!