mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-05 01:32:40 +02:00
adapt the new interface of the variational posterior distribution.
This commit is contained in:
parent
34d9f90d92
commit
99c6a2095f
7 changed files with 96 additions and 389 deletions
|
|
@ -29,3 +29,29 @@ class Normal(Parameterized):
|
|||
assert "matplotlib" in sys.modules, "matplotlib package has not been imported."
|
||||
from ...plotting.matplot_dep import variational_plots
|
||||
return variational_plots.plot(self,*args)
|
||||
|
||||
|
||||
class SpikeAndSlab(Parameterized):
|
||||
'''
|
||||
The SpikeAndSlab distribution for variational approximations.
|
||||
'''
|
||||
def __init__(self, means, variances, binary_prob, name='latent space'):
|
||||
"""
|
||||
binary_prob : the probability of the distribution on the slab part.
|
||||
"""
|
||||
Parameterized.__init__(self, name=name)
|
||||
self.mean = Param("mean", means)
|
||||
self.variance = Param('variance', variances, Logexp())
|
||||
self.gamma = Param("binary_prob",binary_prob,)
|
||||
self.add_parameters(self.mean, self.variance, self.gamma)
|
||||
|
||||
def plot(self, *args):
|
||||
"""
|
||||
Plot latent space X in 1D:
|
||||
|
||||
See GPy.plotting.matplot_dep.variational_plots
|
||||
"""
|
||||
import sys
|
||||
assert "matplotlib" in sys.modules, "matplotlib package has not been imported."
|
||||
from ...plotting.matplot_dep import variational_plots
|
||||
return variational_plots.plot(self,*args)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue