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

excited state vmc and tests added #1612

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

victor11235
Copy link

Hi,
Based on https://github.com/orgs/netket/discussions/1593, I have drafted some code for penalty-based excited state protocol. This first version still uses a new driver (instead of a new operator suggested for better integration), so I have put them into experimental features.

I have also modified the tests for groundstate to mainly test the penalty-based gradient (central difference v.s. sample-estimated). Some of the tests are omitted (and for some reasons variational state with real parameters do not pass the test). Might be a bit messy but let me know what you think and I will try to find time to fix up!

@codecov
Copy link

codecov bot commented Oct 14, 2023

Codecov Report

Attention: 18 lines in your changes are missing coverage. Please review.

Comparison is base (45d334e) 83.74% compared to head (f45db46) 84.83%.

❗ Current head f45db46 differs from pull request most recent head 975567c. Consider uploading reports for the commit 975567c to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1612      +/-   ##
==========================================
+ Coverage   83.74%   84.83%   +1.08%     
==========================================
  Files         262      265       +3     
  Lines       14636    15256     +620     
  Branches     2210     2238      +28     
==========================================
+ Hits        12257    12942     +685     
+ Misses       1832     1775      -57     
+ Partials      547      539       -8     
Files Coverage Δ
netket/experimental/excited/__init__.py 100.00% <100.00%> (ø)
netket/experimental/excited/expect_grad_ex.py 93.65% <93.65%> (ø)
netket/experimental/excited/vmc_ex.py 73.58% <73.58%> (ø)

... and 69 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

from netket.experimental.excited import OperatorWithPenalty


class VMC_ex(VMC):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we call this VMC_Excited or something more explicit?

@PhilipVinc
Copy link
Member

Hi @victor11235 , thanks for the contribution!

I adapted a bit your PR to the style that we want to keep in netket, mainly having those 'objects' that behave as operators follow the operator interface such that we can do vstate.expect and vstate.expect_and_grad.

I have not really tested thoroughly that it works correctly right now, so please do that!

From am high level point of view I agree with the proposal.
The main three things that I need to reflect upon are

  • returning both the energy and the 'loss' that is being optimised or loss + infidelity
  • I don't know where to put the excited module. I would like to hide it a bit because in a (not so close) future I would like to do this tricks with Fidelity operator that eventually we'll bring into netket.
  • The interface. I think it's ok but some extra documentation is needed (for example, what should be a good starting beta... etc),

Changes that would be nice to have would be the possibility to update the states/betas, which following my changes do not work anymore but are easy to restore with a setter, and the support for variational states with different 'ansatze', which should be very simple to implement...

I will get back to you with a few more formalised comments in the next few days

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.

None yet

3 participants