Sampling

Draw samples from the distribution, with support for various samplers.

class pypesto.sampling.AdaptiveMetropolisSampler(options: Dict = None)

Bases: pypesto.sampling.metropolis.MetropolisSampler

Metropolis-Hastings sampler with adaptive proposal covariance.

__abstractmethods__ = frozenset()
__class__

alias of abc.ABCMeta

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'pypesto.sampling.adaptive_metropolis', '__doc__': '\n Metropolis-Hastings sampler with adaptive proposal covariance.\n ', '__init__': <function AdaptiveMetropolisSampler.__init__>, 'default_options': <classmethod object>, 'initialize': <function AdaptiveMetropolisSampler.initialize>, '_propose_parameter': <function AdaptiveMetropolisSampler._propose_parameter>, '_update_proposal': <function AdaptiveMetropolisSampler._update_proposal>, '__abstractmethods__': frozenset(), '_abc_registry': <_weakrefset.WeakSet object>, '_abc_cache': <_weakrefset.WeakSet object>, '_abc_negative_cache': <_weakrefset.WeakSet object>, '_abc_negative_cache_version': 48})
__dir__() → list

default dir() implementation

__eq__

Return self==value.

__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__gt__

Return self>value.

__hash__

Return hash(self).

__init__(options: Dict = None)

Initialize self. See help(type(self)) for accurate signature.

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__

Return self<=value.

__lt__

Return self<value.

__module__ = 'pypesto.sampling.adaptive_metropolis'
__ne__

Return self!=value.

__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__sizeof__() → int

size of object in memory, in bytes

__str__

Return str(self).

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__weakref__

list of weak references to the object (if defined)

classmethod default_options()

Convenience method to set/get default options.

Returns:Default sampler options.
Return type:default_options
get_last_sample() → pypesto.sampling.sampler.InternalSample

Get the last sample in the chain.

Returns:The last sample in the chain in the exchange format.
Return type:internal_sample
get_samples() → pypesto.sampling.result.McmcPtResult

Get the generated samples.

initialize(problem: pypesto.problem.Problem, x0: numpy.ndarray)

Initialize the sampler.

Parameters:
  • problem – The problem for which to sample.
  • x0 – Should, but is not required to, be used as initial parameter.
sample(n_samples: int, beta: float = 1.0)

Perform sampling.

Parameters:
  • n_samples – Number of samples to generate.
  • beta – Inverse of the temperature to which the system is elevated.
set_last_sample(sample: pypesto.sampling.sampler.InternalSample)

Set the last sample in the chain to the passed value.

Parameters:sample – The sample that will replace the last sample in the chain.
classmethod translate_options(options)

Convenience method to translate options and fill in defaults.

Parameters:options – Options configuring the sampler.
class pypesto.sampling.AdaptiveParallelTemperingSampler(internal_sampler: pypesto.sampling.sampler.InternalSampler, betas: Sequence[float] = None, n_chains: int = None, options: Dict = None)

Bases: pypesto.sampling.parallel_tempering.ParallelTemperingSampler

Parallel tempering sampler with adaptive temperature adaptation.

__abstractmethods__ = frozenset()
__class__

alias of abc.ABCMeta

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'pypesto.sampling.adaptive_parallel_tempering', '__doc__': 'Parallel tempering sampler with adaptive temperature adaptation.', 'default_options': <classmethod object>, 'adjust_betas': <function AdaptiveParallelTemperingSampler.adjust_betas>, '__abstractmethods__': frozenset(), '_abc_registry': <_weakrefset.WeakSet object>, '_abc_cache': <_weakrefset.WeakSet object>, '_abc_negative_cache': <_weakrefset.WeakSet object>, '_abc_negative_cache_version': 48})
__dir__() → list

default dir() implementation

__eq__

Return self==value.

__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__gt__

Return self>value.

__hash__

Return hash(self).

__init__(internal_sampler: pypesto.sampling.sampler.InternalSampler, betas: Sequence[float] = None, n_chains: int = None, options: Dict = None)

Initialize self. See help(type(self)) for accurate signature.

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__

Return self<=value.

__lt__

Return self<value.

__module__ = 'pypesto.sampling.adaptive_parallel_tempering'
__ne__

Return self!=value.

__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__sizeof__() → int

size of object in memory, in bytes

__str__

Return str(self).

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__weakref__

list of weak references to the object (if defined)

adjust_betas(i_sample: int, swapped: Sequence[bool])

Update temperatures as in Vousden2016.

classmethod default_options() → Dict

Convenience method to set/get default options.

Returns:Default sampler options.
Return type:default_options
get_samples() → pypesto.sampling.result.McmcPtResult

Concatenate all chains.

initialize(problem: pypesto.problem.Problem, x0: Union[numpy.ndarray, List[numpy.ndarray]])

Initialize the sampler.

Parameters:
  • problem – The problem for which to sample.
  • x0 – Should, but is not required to, be used as initial parameter.
sample(n_samples: int, beta: float = 1.0)

Perform sampling.

Parameters:
  • n_samples – Number of samples to generate.
  • beta – Inverse of the temperature to which the system is elevated.
swap_samples() → Sequence[bool]

Swap samples as in Vousden2016.

classmethod translate_options(options)

Convenience method to translate options and fill in defaults.

Parameters:options – Options configuring the sampler.
class pypesto.sampling.InternalSampler(options: Dict = None)

Bases: pypesto.sampling.sampler.Sampler

Sampler to be used inside a parallel tempering sampler.

The last sample can be obtained via get_last_sample and set via set_last_sample.

__abstractmethods__ = frozenset({'set_last_sample', 'get_samples', 'initialize', 'get_last_sample', 'sample'})
__class__

alias of abc.ABCMeta

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'pypesto.sampling.sampler', '__doc__': 'Sampler to be used inside a parallel tempering sampler.\n\n The last sample can be obtained via `get_last_sample` and set via\n `set_last_sample`.\n ', 'get_last_sample': <function InternalSampler.get_last_sample>, 'set_last_sample': <function InternalSampler.set_last_sample>, '__abstractmethods__': frozenset({'set_last_sample', 'get_samples', 'initialize', 'get_last_sample', 'sample'}), '_abc_registry': <_weakrefset.WeakSet object>, '_abc_cache': <_weakrefset.WeakSet object>, '_abc_negative_cache': <_weakrefset.WeakSet object>, '_abc_negative_cache_version': 48})
__dir__() → list

default dir() implementation

__eq__

Return self==value.

__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__gt__

Return self>value.

__hash__

Return hash(self).

__init__(options: Dict = None)

Initialize self. See help(type(self)) for accurate signature.

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__

Return self<=value.

__lt__

Return self<value.

__module__ = 'pypesto.sampling.sampler'
__ne__

Return self!=value.

__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__sizeof__() → int

size of object in memory, in bytes

__str__

Return str(self).

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__weakref__

list of weak references to the object (if defined)

classmethod default_options() → Dict

Convenience method to set/get default options.

Returns:Default sampler options.
Return type:default_options
get_last_sample() → pypesto.sampling.sampler.InternalSample

Get the last sample in the chain.

Returns:The last sample in the chain in the exchange format.
Return type:internal_sample
get_samples() → pypesto.sampling.result.McmcPtResult

Get the generated samples.

initialize(problem: pypesto.problem.Problem, x0: Union[numpy.ndarray, List[numpy.ndarray]])

Initialize the sampler.

Parameters:
  • problem – The problem for which to sample.
  • x0 – Should, but is not required to, be used as initial parameter.
sample(n_samples: int, beta: float = 1.0)

Perform sampling.

Parameters:
  • n_samples – Number of samples to generate.
  • beta – Inverse of the temperature to which the system is elevated.
set_last_sample(sample: pypesto.sampling.sampler.InternalSample)

Set the last sample in the chain to the passed value.

Parameters:sample – The sample that will replace the last sample in the chain.
classmethod translate_options(options)

Convenience method to translate options and fill in defaults.

Parameters:options – Options configuring the sampler.
class pypesto.sampling.McmcPtResult(trace_x: numpy.ndarray, trace_fval: numpy.ndarray, betas: Iterable[float], message: str = None)

Bases: dict

The result of a sampler run using Markov-chain Monte Carlo, and optionally parallel tempering.

Can be used like a dict.

Parameters:
  • trace_x ([n_chain, n_iter, n_par]) – Parameters
  • trace_fval ([n_chain, n_iter]) – Function values.
  • betas ([n_chain]) – The associated inverse temperatures.
  • message (str) – Textual comment on the profile result.
  • n_chain denotes the number of chains, n_iter the number of (Here,) –
  • (i.e., the chain length), and n_par the number of parameters. (iterations) –
__class__

alias of builtins.type

__contains__()

True if D has a key k, else False.

__delattr__

Delete self[key].

__delitem__

Delete self[key].

__dict__ = mappingproxy({'__module__': 'pypesto.sampling.result', '__doc__': 'The result of a sampler run using Markov-chain Monte Carlo, and\n optionally parallel tempering.\n\n Can be used like a dict.\n\n Parameters\n ----------\n trace_x: [n_chain, n_iter, n_par]\n Parameters\n trace_fval: [n_chain, n_iter]\n Function values.\n betas: [n_chain]\n The associated inverse temperatures.\n message: str\n Textual comment on the profile result.\n\n Here, `n_chain` denotes the number of chains, `n_iter` the number of\n iterations (i.e., the chain length), and `n_par` the number of parameters.\n ', '__init__': <function McmcPtResult.__init__>, '__getattr__': <function McmcPtResult.__getattr__>, '__setattr__': <slot wrapper '__setitem__' of 'dict' objects>, '__delattr__': <slot wrapper '__delitem__' of 'dict' objects>, '__dict__': <attribute '__dict__' of 'McmcPtResult' objects>, '__weakref__': <attribute '__weakref__' of 'McmcPtResult' objects>})
__dir__() → list

default dir() implementation

__eq__

Return self==value.

__format__()

default object formatter

__ge__

Return self>=value.

__getattr__(key)
__getattribute__

Return getattr(self, name).

__getitem__()

x.__getitem__(y) <==> x[y]

__gt__

Return self>value.

__hash__ = None
__init__(trace_x: numpy.ndarray, trace_fval: numpy.ndarray, betas: Iterable[float], message: str = None)

Initialize self. See help(type(self)) for accurate signature.

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__iter__

Implement iter(self).

__le__

Return self<=value.

__len__

Return len(self).

__lt__

Return self<value.

__module__ = 'pypesto.sampling.result'
__ne__

Return self!=value.

__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__

Return repr(self).

__setattr__

Set self[key] to value.

__setitem__

Set self[key] to value.

__sizeof__() → size of D in memory, in bytes
__str__

Return str(self).

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__weakref__

list of weak references to the object (if defined)

clear() → None. Remove all items from D.
copy() → a shallow copy of D
fromkeys()

Returns a new dict with keys from iterable and values equal to value.

get(k[, d]) → D[k] if k in D, else d. d defaults to None.
items() → a set-like object providing a view on D's items
keys() → a set-like object providing a view on D's keys
pop(k[, d]) → v, remove specified key and return the corresponding value.

If key is not found, d is returned if given, otherwise KeyError is raised

popitem() → (k, v), remove and return some (key, value) pair as a

2-tuple; but raise KeyError if D is empty.

setdefault(k[, d]) → D.get(k,d), also set D[k]=d if k not in D
update([E, ]**F) → None. Update D from dict/iterable E and F.

If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]

values() → an object providing a view on D's values
class pypesto.sampling.MetropolisSampler(options: Dict = None)

Bases: pypesto.sampling.sampler.InternalSampler

Simple Metropolis-Hastings sampler with fixed proposal variance.

__abstractmethods__ = frozenset()
__class__

alias of abc.ABCMeta

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'pypesto.sampling.metropolis', '__doc__': '\n Simple Metropolis-Hastings sampler with fixed proposal variance.\n ', '__init__': <function MetropolisSampler.__init__>, 'default_options': <classmethod object>, 'initialize': <function MetropolisSampler.initialize>, 'sample': <function MetropolisSampler.sample>, '_perform_step': <function MetropolisSampler._perform_step>, '_propose_parameter': <function MetropolisSampler._propose_parameter>, '_update_proposal': <function MetropolisSampler._update_proposal>, 'get_last_sample': <function MetropolisSampler.get_last_sample>, 'set_last_sample': <function MetropolisSampler.set_last_sample>, 'get_samples': <function MetropolisSampler.get_samples>, '__abstractmethods__': frozenset(), '_abc_registry': <_weakrefset.WeakSet object>, '_abc_cache': <_weakrefset.WeakSet object>, '_abc_negative_cache': <_weakrefset.WeakSet object>, '_abc_negative_cache_version': 48})
__dir__() → list

default dir() implementation

__eq__

Return self==value.

__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__gt__

Return self>value.

__hash__

Return hash(self).

__init__(options: Dict = None)

Initialize self. See help(type(self)) for accurate signature.

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__

Return self<=value.

__lt__

Return self<value.

__module__ = 'pypesto.sampling.metropolis'
__ne__

Return self!=value.

__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__sizeof__() → int

size of object in memory, in bytes

__str__

Return str(self).

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__weakref__

list of weak references to the object (if defined)

classmethod default_options()

Convenience method to set/get default options.

Returns:Default sampler options.
Return type:default_options
get_last_sample() → pypesto.sampling.sampler.InternalSample

Get the last sample in the chain.

Returns:The last sample in the chain in the exchange format.
Return type:internal_sample
get_samples() → pypesto.sampling.result.McmcPtResult

Get the generated samples.

initialize(problem: pypesto.problem.Problem, x0: numpy.ndarray)

Initialize the sampler.

Parameters:
  • problem – The problem for which to sample.
  • x0 – Should, but is not required to, be used as initial parameter.
sample(n_samples: int, beta: float = 1.0)

Perform sampling.

Parameters:
  • n_samples – Number of samples to generate.
  • beta – Inverse of the temperature to which the system is elevated.
set_last_sample(sample: pypesto.sampling.sampler.InternalSample)

Set the last sample in the chain to the passed value.

Parameters:sample – The sample that will replace the last sample in the chain.
classmethod translate_options(options)

Convenience method to translate options and fill in defaults.

Parameters:options – Options configuring the sampler.
class pypesto.sampling.ParallelTemperingSampler(internal_sampler: pypesto.sampling.sampler.InternalSampler, betas: Sequence[float] = None, n_chains: int = None, options: Dict = None)

Bases: pypesto.sampling.sampler.Sampler

Simple parallel tempering sampler.

__abstractmethods__ = frozenset()
__class__

alias of abc.ABCMeta

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'pypesto.sampling.parallel_tempering', '__doc__': 'Simple parallel tempering sampler.', '__init__': <function ParallelTemperingSampler.__init__>, 'default_options': <classmethod object>, 'initialize': <function ParallelTemperingSampler.initialize>, 'sample': <function ParallelTemperingSampler.sample>, 'get_samples': <function ParallelTemperingSampler.get_samples>, 'swap_samples': <function ParallelTemperingSampler.swap_samples>, 'adjust_betas': <function ParallelTemperingSampler.adjust_betas>, '__abstractmethods__': frozenset(), '_abc_registry': <_weakrefset.WeakSet object>, '_abc_cache': <_weakrefset.WeakSet object>, '_abc_negative_cache': <_weakrefset.WeakSet object>, '_abc_negative_cache_version': 48})
__dir__() → list

default dir() implementation

__eq__

Return self==value.

__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__gt__

Return self>value.

__hash__

Return hash(self).

__init__(internal_sampler: pypesto.sampling.sampler.InternalSampler, betas: Sequence[float] = None, n_chains: int = None, options: Dict = None)

Initialize self. See help(type(self)) for accurate signature.

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__

Return self<=value.

__lt__

Return self<value.

__module__ = 'pypesto.sampling.parallel_tempering'
__ne__

Return self!=value.

__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__sizeof__() → int

size of object in memory, in bytes

__str__

Return str(self).

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__weakref__

list of weak references to the object (if defined)

adjust_betas(i_sample: int, swapped: Sequence[bool])

Adjust temperature values. Default: Do nothing.

classmethod default_options() → Dict

Convenience method to set/get default options.

Returns:Default sampler options.
Return type:default_options
get_samples() → pypesto.sampling.result.McmcPtResult

Concatenate all chains.

initialize(problem: pypesto.problem.Problem, x0: Union[numpy.ndarray, List[numpy.ndarray]])

Initialize the sampler.

Parameters:
  • problem – The problem for which to sample.
  • x0 – Should, but is not required to, be used as initial parameter.
sample(n_samples: int, beta: float = 1.0)

Perform sampling.

Parameters:
  • n_samples – Number of samples to generate.
  • beta – Inverse of the temperature to which the system is elevated.
swap_samples() → Sequence[bool]

Swap samples as in Vousden2016.

classmethod translate_options(options)

Convenience method to translate options and fill in defaults.

Parameters:options – Options configuring the sampler.
class pypesto.sampling.Sampler(options: Dict = None)

Bases: abc.ABC

Sampler base class, not functional on its own.

The sampler maintains an internal chain, which is initialized in initialize, and updated in sample.

__abstractmethods__ = frozenset({'get_samples', 'initialize', 'sample'})
__class__

alias of abc.ABCMeta

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'pypesto.sampling.sampler', '__doc__': 'Sampler base class, not functional on its own.\n\n The sampler maintains an internal chain, which is initialized in\n `initialize`, and updated in `sample`.\n ', '__init__': <function Sampler.__init__>, 'initialize': <function Sampler.initialize>, 'sample': <function Sampler.sample>, 'get_samples': <function Sampler.get_samples>, 'default_options': <classmethod object>, 'translate_options': <classmethod object>, '__abstractmethods__': frozenset({'get_samples', 'initialize', 'sample'}), '_abc_registry': <_weakrefset.WeakSet object>, '_abc_cache': <_weakrefset.WeakSet object>, '_abc_negative_cache': <_weakrefset.WeakSet object>, '_abc_negative_cache_version': 48})
__dir__() → list

default dir() implementation

__eq__

Return self==value.

__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__gt__

Return self>value.

__hash__

Return hash(self).

__init__(options: Dict = None)

Initialize self. See help(type(self)) for accurate signature.

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__

Return self<=value.

__lt__

Return self<value.

__module__ = 'pypesto.sampling.sampler'
__ne__

Return self!=value.

__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__sizeof__() → int

size of object in memory, in bytes

__str__

Return str(self).

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__weakref__

list of weak references to the object (if defined)

classmethod default_options() → Dict

Convenience method to set/get default options.

Returns:Default sampler options.
Return type:default_options
get_samples() → pypesto.sampling.result.McmcPtResult

Get the generated samples.

initialize(problem: pypesto.problem.Problem, x0: Union[numpy.ndarray, List[numpy.ndarray]])

Initialize the sampler.

Parameters:
  • problem – The problem for which to sample.
  • x0 – Should, but is not required to, be used as initial parameter.
sample(n_samples: int, beta: float = 1.0)

Perform sampling.

Parameters:
  • n_samples – Number of samples to generate.
  • beta – Inverse of the temperature to which the system is elevated.
classmethod translate_options(options)

Convenience method to translate options and fill in defaults.

Parameters:options – Options configuring the sampler.
pypesto.sampling.sample(problem: pypesto.problem.Problem, n_samples: int, sampler: pypesto.sampling.sampler.Sampler = None, x0: Union[numpy.ndarray, List[numpy.ndarray]] = None, result: pypesto.result.Result = None) → pypesto.result.Result

This is the main function to call to do parameter sampling.

Parameters:
  • problem – The problem to be solved. If None is provided, a pypesto.AdaptiveMetropolisSampler is used.
  • n_samples – Number of samples to generate.
  • sampler – The sampler to perform the actual sampling.
  • x0 – Initial parameter for the Markov chain. If None, the best parameter found in optimization is used. Note that some samplers require an initial parameter, some may ignore it. x0 can also be a list, to have separate starting points for parallel tempering chains.
  • result – A result to write to. If None provided, one is created from the problem.
Returns:

A result with filled in sample_options part.

Return type:

result