dimod.SampleSet.from_serializable#

classmethod SampleSet.from_serializable(obj)[source]#

Deserialize a SampleSet.

Parameters:

obj (dict) – A SampleSet serialized by to_serializable().

Returns:

SampleSet

Examples

This example encodes and decodes using JSON.

>>> import json
...
>>> samples = dimod.SampleSet.from_samples([-1, 1, -1], dimod.SPIN, energy=-.5)
>>> s = json.dumps(samples.to_serializable())
>>> new_samples = dimod.SampleSet.from_serializable(json.loads(s))