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 option for continuous sampling #24

Open
randomir opened this issue Dec 6, 2021 · 4 comments
Open

Add option for continuous sampling #24

randomir opened this issue Dec 6, 2021 · 4 comments
Labels
feature New feature or request

Comments

@randomir
Copy link
Member

randomir commented Dec 6, 2021

Keeping N samples in memory is expensive if we only want the k best ones!

Open question is the interface -- num_reads is synonymous with num_samples returned in sample set for all samplers in Ocean. Also, initial_states (even for random states) are expanded to num_reads input samples -- something we would also want to avoid in this case.

To retain compatible behavior with existing samplers, perhaps we could introduce a parameter like num_resample. Also, resample_reduce_method (min/max). And to support the k best samples use case, we'll need a parameter like num_samples.

So, something like:

ss = greedy.sample(bqm, num_reads=1, num_resample=1000, num_samples=3, resample_reduce_method='k-best')

Another take on this would be async sampler interface. In which case a caller would yield as many samples are needed, all with minimal memory overhead!

@jackraymond
Copy link

jackraymond commented Feb 9, 2022

DWaveSampler uses the parameters answer_mode and max_answers in addition to num_reads. For compatibility these may be good naming convention in other dimod samplers, addressing related issues. max_samples for the QPU assumes 'k-best', I don't think there are (many) interesting use cases beyond k-best

@randomir
Copy link
Member Author

randomir commented Feb 9, 2022

Is there a way, using these existing parameters, to express: "run N descends, but return only k best ones"? You answered in your edit already. 😄

@JoelPasvolsky
Copy link
Contributor

JoelPasvolsky commented Feb 9, 2022

uses the parameters 'sampling_mode'

Do you mean answer_mode and max_answers?

@jackraymond
Copy link

Names here: https://docs.dwavesys.com/docs/latest/c_solver_parameters.html - I corrected the initial comment as well.

@randomir randomir added the feature New feature or request label Jan 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants