dwavesystems / dwave-system

An API for easily incorporating the D-Wave system as a sampler, either directly or through Leap's cloud-based hybrid samplers
https://docs.ocean.dwavesys.com/
Apache License 2.0
87 stars 62 forks source link

Temperature feature #436

Closed jackraymond closed 1 year ago

jackraymond commented 2 years ago

Routines are provided to efficiently establish the temperature of a Classical Boltzmann sampler from a set of samples for an arbitary Hamiltonian. This can be used to provide an estimate to the QPU 'effective temperature' (T), where it is assumed the QPU returns Boltzmann samples P(x) = exp(-H(x)/T)/Z where H(x) is the problem Hamiltonian and Z is the partition function. This is a common support question. Uses of the QPU as a Boltzmann sampler include machine learning applications.

codecov-commenter commented 2 years ago

Codecov Report

Merging #436 (cbd9958) into master (97ac44f) will decrease coverage by 5.07%. The diff coverage is 80.95%.

@@            Coverage Diff             @@
##           master     #436      +/-   ##
==========================================
- Coverage   91.05%   85.97%   -5.08%     
==========================================
  Files          23       24       +1     
  Lines        1543     1669     +126     
==========================================
+ Hits         1405     1435      +30     
- Misses        138      234      +96     
Impacted Files Coverage Δ
dwave/system/temperatures.py 80.64% <80.64%> (ø)
dwave/system/__init__.py 100.00% <100.00%> (ø)
dwave/system/coupling_groups.py 12.50% <0.00%> (-81.25%) :arrow_down:
dwave/system/samplers/leap_hybrid_sampler.py 61.42% <0.00%> (-14.29%) :arrow_down:
dwave/system/samplers/clique.py 73.85% <0.00%> (-13.73%) :arrow_down:
dwave/system/samplers/dwave_sampler.py 82.03% <0.00%> (-3.00%) :arrow_down:
dwave/system/composites/embedding.py 96.57% <0.00%> (-1.15%) :arrow_down:
dwave/system/testing.py 95.23% <0.00%> (-0.80%) :arrow_down:

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

arcondello commented 2 years ago

You'll need to also add this to the docs, and resolve any doctest failures. I think the simplest would be to edit https://github.com/dwavesystems/dwave-system/blob/master/docs/reference/utilities.rst to something like

.. _utilities_system:

=========
Utilities
=========

Graph Utilities
--------------

.. automodule:: dwave.system.utilities

.. currentmodule:: dwave.system.utilities

.. autosummary::
   :toctree: generated/

   common_working_graph

Temperature Utilities
---------------------

.. automodule:: dwave.system.temperatures

.. currentmodule:: dwave.system.temperatures

.. autosummary::
   :toctree: generated/

   effective_field
   maximum_pseudolikelihood_temperature
   freezeout_effective_temperature
   fast_effective_temperature
jackraymond commented 2 years ago

As part of getting doctest to work had to overflow (beyond 80 characters) some lines, and # doctest: +SKIP to bypass this error: WARNING: broken link: https://www.jstor.org/stable/25464568 (403 Client Error: Forbidden for url: https://www.jstor.org/stable/25464568) Link works fine in compiled documentation.

JoelPasvolsky commented 2 years ago

@jackraymond, looks like this website detects & reject robots from accessing https://www.jstor.org/stable: if you try with curl it returns Please complete this reCAPTCHA to demonstrate that it's you making the requests and not a robot.

We can update code line linkcheck_ignore = [r'https://cloud.dwavesys.com/leap', # redirects, many checks in https://github.com/dwavesystems/dwave-system/blob/master/docs/conf.py and https://github.com/dwavesystems/dwave-ocean-sdk/blob/master/docs/conf.py to ignore URL https://www.jstor.org/stable

davidmerwin commented 2 years ago

❤️

davidmerwin commented 2 years ago

❤️