mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-07-14 16:32:15 +02:00
Merge branch 'devel' of github.com:SheffieldML/GPy into devel
This commit is contained in:
commit
7760730230
4 changed files with 14 additions and 43 deletions
|
|
@ -1,22 +1,23 @@
|
||||||
"""HMC implementation"""
|
# ## Copyright (c) 2012, GPy authors (see AUTHORS.txt).
|
||||||
|
# Licensed under the BSD 3-clause license (see LICENSE.txt)
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
|
|
||||||
class HMC:
|
class HMC:
|
||||||
"""
|
"""
|
||||||
An implementation of Hybrid Monte Carlo (HMC) for GPy models
|
An implementation of Hybrid Monte Carlo (HMC) for GPy models
|
||||||
|
|
||||||
|
Initialize an object for HMC sampling. Note that the status of the model (model parameters) will be changed during sampling.
|
||||||
|
|
||||||
|
:param model: the GPy model that will be sampled
|
||||||
|
:type model: GPy.core.Model
|
||||||
|
:param M: the mass matrix (an identity matrix by default)
|
||||||
|
:type M: numpy.ndarray
|
||||||
|
:param stepsize: the step size for HMC sampling
|
||||||
|
:type stepsize: float
|
||||||
"""
|
"""
|
||||||
def __init__(self, model, M=None,stepsize=1e-1):
|
def __init__(self, model, M=None,stepsize=1e-1):
|
||||||
"""
|
|
||||||
Initialize an object for HMC sampling. Note that the status of the model (model parameters) will be changed during sampling
|
|
||||||
:param model: the GPy model that will be sampled
|
|
||||||
:type model: GPy.core.Model
|
|
||||||
:param M: the mass matrix (an identity matrix by default)
|
|
||||||
:type M: numpy.ndarray
|
|
||||||
:param stepsize: the step size for HMC sampling
|
|
||||||
:type stepsize: float
|
|
||||||
"""
|
|
||||||
self.model = model
|
self.model = model
|
||||||
self.stepsize = stepsize
|
self.stepsize = stepsize
|
||||||
self.p = np.empty_like(model.optimizer_array.copy())
|
self.p = np.empty_like(model.optimizer_array.copy())
|
||||||
|
|
@ -29,6 +30,7 @@ class HMC:
|
||||||
def sample(self, num_samples=1000, hmc_iters=20):
|
def sample(self, num_samples=1000, hmc_iters=20):
|
||||||
"""
|
"""
|
||||||
Sample the (unfixed) model parameters.
|
Sample the (unfixed) model parameters.
|
||||||
|
|
||||||
:param num_samples: the number of samples to draw (1000 by default)
|
:param num_samples: the number of samples to draw (1000 by default)
|
||||||
:type num_samples: int
|
:type num_samples: int
|
||||||
:param hmc_iters: the number of leap-frog iterations (20 by default)
|
:param hmc_iters: the number of leap-frog iterations (20 by default)
|
||||||
|
|
|
||||||
|
|
@ -4,14 +4,6 @@ GPy.inference.optimization package
|
||||||
Submodules
|
Submodules
|
||||||
----------
|
----------
|
||||||
|
|
||||||
GPy.inference.optimization.BayesOpt module
|
|
||||||
------------------------------------------
|
|
||||||
|
|
||||||
.. automodule:: GPy.inference.optimization.BayesOpt
|
|
||||||
:members:
|
|
||||||
:undoc-members:
|
|
||||||
:show-inheritance:
|
|
||||||
|
|
||||||
GPy.inference.optimization.conjugate_gradient_descent module
|
GPy.inference.optimization.conjugate_gradient_descent module
|
||||||
------------------------------------------------------------
|
------------------------------------------------------------
|
||||||
|
|
||||||
|
|
@ -28,14 +20,6 @@ GPy.inference.optimization.gradient_descent_update_rules module
|
||||||
:undoc-members:
|
:undoc-members:
|
||||||
:show-inheritance:
|
:show-inheritance:
|
||||||
|
|
||||||
GPy.inference.optimization.hmc module
|
|
||||||
-------------------------------------
|
|
||||||
|
|
||||||
.. automodule:: GPy.inference.optimization.hmc
|
|
||||||
:members:
|
|
||||||
:undoc-members:
|
|
||||||
:show-inheritance:
|
|
||||||
|
|
||||||
GPy.inference.optimization.optimization module
|
GPy.inference.optimization.optimization module
|
||||||
----------------------------------------------
|
----------------------------------------------
|
||||||
|
|
||||||
|
|
@ -44,14 +28,6 @@ GPy.inference.optimization.optimization module
|
||||||
:undoc-members:
|
:undoc-members:
|
||||||
:show-inheritance:
|
:show-inheritance:
|
||||||
|
|
||||||
GPy.inference.optimization.samplers module
|
|
||||||
------------------------------------------
|
|
||||||
|
|
||||||
.. automodule:: GPy.inference.optimization.samplers
|
|
||||||
:members:
|
|
||||||
:undoc-members:
|
|
||||||
:show-inheritance:
|
|
||||||
|
|
||||||
GPy.inference.optimization.scg module
|
GPy.inference.optimization.scg module
|
||||||
-------------------------------------
|
-------------------------------------
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ Subpackages
|
||||||
.. toctree::
|
.. toctree::
|
||||||
|
|
||||||
GPy.inference.latent_function_inference
|
GPy.inference.latent_function_inference
|
||||||
|
GPy.inference.mcmc
|
||||||
GPy.inference.optimization
|
GPy.inference.optimization
|
||||||
|
|
||||||
Module contents
|
Module contents
|
||||||
|
|
|
||||||
|
|
@ -84,14 +84,6 @@ GPy.testing.prior_tests module
|
||||||
:undoc-members:
|
:undoc-members:
|
||||||
:show-inheritance:
|
:show-inheritance:
|
||||||
|
|
||||||
GPy.testing.sparse_tests module
|
|
||||||
-------------------------------
|
|
||||||
|
|
||||||
.. automodule:: GPy.testing.sparse_tests
|
|
||||||
:members:
|
|
||||||
:undoc-members:
|
|
||||||
:show-inheritance:
|
|
||||||
|
|
||||||
|
|
||||||
Module contents
|
Module contents
|
||||||
---------------
|
---------------
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue