Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CP_OPT #351

Open
3 of 5 tasks
ntjohnson1 opened this issue Nov 23, 2024 · 7 comments
Open
3 of 5 tasks

Add CP_OPT #351

ntjohnson1 opened this issue Nov 23, 2024 · 7 comments
Assignees
Labels
doing Actively being worked on enhancement New feature or request

Comments

@ntjohnson1
Copy link
Collaborator

ntjohnson1 commented Nov 23, 2024

Goal: Align implementation with GCP_OPT while retaining the cp_opt top level interface as faithfully as possible.

Components:

  • cp_opt.m
  • ktensor/fg.m
  • tt_opt_lbfgsb.m
  • tt_opt_adam.m
  • cp_opt_doc.m

Won't do unless needed/requested as follow up:

  • cp_opt_legacy.m
  • tt_opt_lbfgs.m, Poblano isn't available in python, scipy has a standard BFGS solve but not LBFGS. With the other implementations adding a new optimizer shouldn't be too much of a burden
  • tt_opt_compact.m The solver from this paper is publicly available but uses pytorch. That's a pretty heavy include for our project (also it doesn't look like they publish the solver to pypi)
  • tt_opt_fmincon.m/ tt_opt_fminunc.m Both of these seem to use matlab optimization tools that run a variety of heuristics before dispatching to a specific solver. We have an example of lbfgsb from scipy so if there are specific solvers desired we could add those. But would be hard to come up with an apples to apples comparison.
@dmdunla
Copy link
Collaborator

dmdunla commented Nov 23, 2024 via email

@ntjohnson1
Copy link
Collaborator Author

I can take a look at the end (or potentially do it as a follow up).

@ntjohnson1
Copy link
Collaborator Author

I timed out for this afternoon but here is my development branch for this: https://github.com/ntjohnson1/pyttb/tree/nick/cp_opt

I have most of cp_opt, function/gradient handles for the specific cp opt problem, and lbfgsb implemented. Still need to improve doc strings, and tests to confirm things are functionally correct (right now I have a simple test to confirm when the answer is provided for init things word). I basically followed the same internal structure for the solvers in gcp_opt, however the cp_opt components operate on actual tensors rather than just blocks of data so I had to slightly tweak some interfaces. No rush, but feel free to share if you have any thoughts on the layout/alignment with gcp_opt.

I also updated the description for some of the other optimizers python had used. My preference would be to implement a subset of the optimizers if the primary motivation is the textbook rather than real world usage.

@dmdunla
Copy link
Collaborator

dmdunla commented Dec 13, 2024

SG. I think the subset of optimizers you landed on looks good to me. I do not think that we need to replicate Poblano or the Optimization Toolbox for MATLAB routines as a whole as a start. I think that main point is to have an all-at-once method for CP-OPT with reasonable optimizer support first, then flesh this out with other methods as needed.

Have you thought about the extension of CP-OPT to CP-WOPT, in terms of the interface? Those were developed separately in MATLAB, but there may be an opportunity to consider fusion of these in terms of the API, as Stephen Becker's L-BFGS-B tool used by MATLAB does.

@ntjohnson1
Copy link
Collaborator Author

No. I basically got to this point and paused. I can start looking at WOPT before cleaning up/fine tuning this to make sure we can support that with a similar interface as well.

@tgkolda
Copy link

tgkolda commented Dec 16, 2024

I have cleaning up the MATLAB codes on my to-do list. Once I do that, maybe the structure will be clearer here.

@ntjohnson1
Copy link
Collaborator Author

I have cleaning up the MATLAB codes on my to-do list. Once I do that, maybe the structure will be clearer here.

I think right now MATLAB, pyttb, and genten all have slightly different formats for GCP. Here we were aiming to align the pyttb GCP format with CP-OPT and CP-WOPT. Feel free to take a look at our setup, or we can chat if that's helpful. The top level call to gcp/cpopt/cpwopt should remain the same but the organization of the code is different. Here we tried to align more with a pytorch/sklearn/machine learning based organization with the optimizers etc since that seems to be most familiar for python users.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doing Actively being worked on enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants