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

Feature: State Weighted eDMD (SW-eDMD) #88

Merged
merged 19 commits into from
Apr 26, 2024
Merged

Feature: State Weighted eDMD (SW-eDMD) #88

merged 19 commits into from
Apr 26, 2024

Conversation

EthanJamesLew
Copy link
Owner

Summary

This is an implementation of our novel eDMD algorithm that allows states and snapshots to be weighted. A conversion is done in the objective to translate weights on state to weights on observables.

  • The notebook weighted-cost-func.ipynb has a complete example of the method

CC @Abdu-Hekal

@EthanJamesLew EthanJamesLew changed the title Feature: State Weighted eDMD (SW-eDMD) Draft: Feature: State Weighted eDMD (SW-eDMD) Apr 13, 2024
@Abdu-Hekal
Copy link
Collaborator

Abdu-Hekal commented Apr 13, 2024

Great, Thank you! @EthanJamesLew
There seems to be an issue when only 1 trajectory is used, an error is thrown. The issue seems to be due to the size of weights being 1. The computed Atilde in this case in sw-edmdc is None. You can recreate the issue by setting the number of training trajectories in the weighted-cost-func.ipynb notebook to 1.

@Abdu-Hekal
Copy link
Collaborator

It seems the issue isn't just for a low number of trajectories, but in general when sw-edmdc fails to find a solution, which may be related to limited data. @EthanJamesLew

@EthanJamesLew
Copy link
Owner Author

@Abdu-Hekal I can certainly present an error for that. However, would it be better to present a warning and switch to unweighted eDMD?

@Abdu-Hekal
Copy link
Collaborator

@EthanJamesLew Yes I agree! Is this issue simply inherent due to the approach, where it just fails to find a reasonable solution due to limited data?

@EthanJamesLew
Copy link
Owner Author

@Abdu-Hekal I will investigate...

Also, I have another idea for reweighting--to move some of the reweighting to the RFFs in addition to the DMD stage. I will attend to this and then play with reweighting the observables directly (data-adaptive).

@Abdu-Hekal
Copy link
Collaborator

Perfect! @EthanJamesLew
I will revert back to testing with previous weighting method in the meantime

@EthanJamesLew
Copy link
Owner Author

@Abdu-Hekal added regularization for the sparse data case. I think it's ready to try now.

@Abdu-Hekal
Copy link
Collaborator

@EthanJamesLew Great! No errors now. The fit for the weighted approach though seems to be much worse. For reference I am attaching two images, one with weighting and one without for learning the Automatic transmission model with 1 training trajectory. I am using a weight of one for all point so the result is expected to be the same.
default
weighted

The poorly learnt model with weighting reminds of issues with normalization, is there something similar going on here?

@EthanJamesLew
Copy link
Owner Author

@Abdu-Hekal I can guess what's going on (large state values cause numerical instability during optimization). However, to avoid wasting your time, can you please see me a couple of those trajectories so that I can test them on my machine. A simple CSV or mat file will do. Thanks

@Abdu-Hekal
Copy link
Collaborator

@EthanJamesLew Sent them, Thank you!

@EthanJamesLew EthanJamesLew self-assigned this Apr 19, 2024
@Abdu-Hekal
Copy link
Collaborator

Abdu-Hekal commented Apr 20, 2024

@EthanJamesLew Maybe we should investigate the discrepancy when using different weights, where weights are the same for all points and all trajectories. We should ideally expect the same results if all weights are equal. Whilst using a weight of 1e-4 no explosion in values occurs, falsification results are much worse for the majority of benchmarks. Using a weight of 1 seems to give comparable results to non-weighted, despite very bad learning for a trainset of 1-2 trajectories, as it stabilizes later on. Maybe we could investigate different solvers as well, which might also help reduce runtime.

change to rank adaptation problem for sw-edmd
modify weighted cost func for new rank values
@EthanJamesLew
Copy link
Owner Author

@Abdu-Hekal I changed SW-eDMD to use rank adaptation. It now performs better on the sparsity examples that I tested

full_rank.pdf
rank_adapted.pdf

@EthanJamesLew EthanJamesLew changed the title Draft: Feature: State Weighted eDMD (SW-eDMD) Feature: State Weighted eDMD (SW-eDMD) Apr 24, 2024
@EthanJamesLew EthanJamesLew merged commit 77de218 into main Apr 26, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants