mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-10 20:42:39 +02:00
add ss_mrd model
This commit is contained in:
parent
8a4a4e56a9
commit
35eb0a015f
7 changed files with 45 additions and 3 deletions
|
|
@ -259,6 +259,11 @@ class PSICOMP_RBF_GPU(PSICOMP_RBF):
|
|||
self.g_compDenom = module.get_function('compDenom')
|
||||
self.g_compDenom.prepare('PPPPii')
|
||||
|
||||
def __deepcopy__(self, memo):
|
||||
s = PSICOMP_RBF_GPU(threadnum=self.threadnum, blocknum=self.blocknum, GPU_direct=self.GPU_direct)
|
||||
memo[id(self)] = s
|
||||
return s
|
||||
|
||||
def _initGPUCache(self, N, M, Q):
|
||||
if self.gpuCache == None:
|
||||
self.gpuCache = {
|
||||
|
|
|
|||
|
|
@ -309,6 +309,11 @@ class PSICOMP_SSRBF_GPU(PSICOMP_RBF):
|
|||
self.g_compDenom = module.get_function('compDenom')
|
||||
self.g_compDenom.prepare('PPPPPPPii')
|
||||
|
||||
def __deepcopy__(self, memo):
|
||||
s = PSICOMP_SSRBF_GPU(threadnum=self.threadnum, blocknum=self.blocknum, GPU_direct=self.GPU_direct)
|
||||
memo[id(self)] = s
|
||||
return s
|
||||
|
||||
def _initGPUCache(self, N, M, Q):
|
||||
if self.gpuCache == None:
|
||||
self.gpuCache = {
|
||||
|
|
|
|||
|
|
@ -43,6 +43,15 @@ class RBF(Stationary):
|
|||
def __setstate__(self, state):
|
||||
return super(RBF, self).__setstate__(state)
|
||||
|
||||
# def copy(self):
|
||||
# k = super(RBF, self).copy()
|
||||
# # Make sure the copy of the kernel instance has different instance of psicomp
|
||||
# if k.useGPU:
|
||||
# k.psicomp = PSICOMP_RBF_GPU()
|
||||
# else:
|
||||
# k.psicomp = PSICOMP_RBF()
|
||||
# return k
|
||||
|
||||
#---------------------------------------#
|
||||
# PSI statistics #
|
||||
#---------------------------------------#
|
||||
|
|
|
|||
|
|
@ -17,3 +17,4 @@ from ss_gplvm import SSGPLVM
|
|||
from gp_coregionalized_regression import GPCoregionalizedRegression
|
||||
from sparse_gp_coregionalized_regression import SparseGPCoregionalizedRegression
|
||||
from gp_heteroscedastic_regression import GPHeteroscedasticRegression
|
||||
from ss_mrd import SSMRD
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ class SSGPLVM(SparseGP):
|
|||
|
||||
"""
|
||||
def __init__(self, Y, input_dim, X=None, X_variance=None, init='PCA', num_inducing=10,
|
||||
Z=None, kernel=None, inference_method=None, likelihood=None, name='Spike-and-Slab GPLVM', group_spike=False, mpi_comm=None, **kwargs):
|
||||
Z=None, kernel=None, inference_method=None, likelihood=None, name='Spike_and_Slab GPLVM', group_spike=False, mpi_comm=None, **kwargs):
|
||||
|
||||
self.mpi_comm = mpi_comm
|
||||
self.__IN_OPTIMIZATION__ = False
|
||||
|
|
|
|||
22
GPy/models/ss_mrd.py
Normal file
22
GPy/models/ss_mrd.py
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
"""
|
||||
The Maniforld Relevance Determination model with the spike-and-slab prior
|
||||
"""
|
||||
|
||||
from ..core import Model
|
||||
from .ss_gplvm import SSGPLVM
|
||||
|
||||
class SSMRD(Model):
|
||||
|
||||
def __init__(self, Ylist, input_dim, X=None, X_variance=None,
|
||||
initx = 'PCA', initz = 'permute',
|
||||
num_inducing=10, Z=None, kernel=None,
|
||||
inference_method=None, likelihoods=None, name='ss_mrd', Ynames=None):
|
||||
super(SSMRD, self).__init__(name)
|
||||
|
||||
self.updates = False
|
||||
self.models = [SSGPLVM(y, input_dim, X=X, X_variance=X_variance, num_inducing=num_inducing,Z=Z,init=initx,
|
||||
kernel=kernel if kernel else None,inference_method=inference_method,likelihood=likelihoods,
|
||||
name='model_'+str(i)) for i,y in enumerate(Ylist)]
|
||||
self.add_parameters(*(self.models))
|
||||
self.updates = True
|
||||
|
||||
|
|
@ -17,7 +17,7 @@ except:
|
|||
pass
|
||||
|
||||
try:
|
||||
if MPI_enabled: #and MPI.COMM_WORLD.size>1:
|
||||
if MPI_enabled and MPI.COMM_WORLD.size>1:
|
||||
from .parallel import get_id_within_node
|
||||
gpuid = get_id_within_node()
|
||||
import pycuda.driver
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue