dimod icon indicating copy to clipboard operation
dimod copied to clipboard

API for overriding Sampler default parameter values at construction time

Open arcondello opened this issue 5 years ago • 2 comments

It would nice to be able to set the default values for Sampler.sample keyword arguments on sampler construction.

Something like

class ASampler(dimod.Sampler):
    ...

    def sample(self, bqm, a=1, b=1, c=1):
        ...

sampler = ASampler(parameter_default=dict(a=5, b=3))
sampleset = sampler.sample(bqm, a=3)  # 3 overrides the 5, but b=3 is used

Generalizes #501 See the use of embedding_parameters in EmbeddingComposite

arcondello avatar Jun 17 '19 17:06 arcondello

That's exactly what **runopts in Hybrid are for -- but right now the interface is a mess and I'm working on generalization (under https://github.com/dwavesystems/dwave-hybrid/issues/141). It proved to be non-trivial.

randomir avatar Jun 17 '19 18:06 randomir

The standard terminology for this functionality seems to be feed_dict, which I personally dislike, but has permeated the tech world via TF. What about parameter_dict instead of ..._default? It's more descriptive of what is expected.

jberwald avatar Jun 17 '19 22:06 jberwald