Question about sampling clamped model in restricted Boltzmann machine example
Hi,
I am trying to sample a clamped model in a restricted Boltzmann machine. Since I could not find the perfect sampler used in the "Training a Restricted Boltzmann Machine to Add " example, I decide to use the hardware to sample a clamped model. In the example, the perfect sampler takes a sub-set qubo problem where the number of visible nodes is reduced from 10 to 4. When I tried to use the original bipartite graph with num_visible = 10 and num_hidden=14, I got an error of "invalid coupler".
What I have done is:
qubo_jobs = compile_jobs([[qubo_dict]], hw_map=r.hw['map'], num_v=4, num_h=10, mode=1)
submitted_problems, gauges = r.send_jobs(qubo_jobs, 1.0)
Error message: "Encoding error: invalid coupler (0,11)"
I think I have to define a new graph and find embeddings.
My question is:
Is there a simple way to use the original graph for sampling the clamped model on hardware?
Comments
Hi Edward,
It looks like you need to minor-embed your problem.
Here are a couple links that will help explain minor-embedding and how it works:
https://docs.dwavesys.com/docs/latest/c_gs_4.html
https://docs.dwavesys.com/docs/latest/c_gs_7.html
You can do your own minor-embedding manually, or there are libraries that can automatically embed your problem for you.
The simplest way is to use the EmbeddingComposite.
Here is a link to the documentation for EmbeddingComposite:
https://docs.ocean.dwavesys.com/projects/system/en/latest/reference/composites/embedding.html
This is a basic example of how you use the EmbeddingComposite:
sampler = EmbeddingComposite(DWaveSampler())
There are definitely advantages to manually embedding.
Fine-tuning and balancing the embedding can produce better results, however using the EmbeddingComposite saves a lot of time and effort, especially on a first pass.
I hope this answers your question.
Please sign in to leave a comment.