mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-24 14:15:14 +02:00
Fixing GP_EP
This commit is contained in:
parent
d286ffe633
commit
b6ffb57263
8 changed files with 638 additions and 5 deletions
|
|
@ -76,11 +76,10 @@ def toy_linear_1d_classification(model_type='Full', inducing=4, seed=default_see
|
|||
|
||||
# create simple GP model
|
||||
if model_type=='Full':
|
||||
m = GPy.models.simple_GP_EP(data['X'],likelihood)
|
||||
m = GPy.models.GP_EP(data['X'],likelihood)
|
||||
else:
|
||||
# create sparse GP EP model
|
||||
m = GPy.models.sparse_GP_EP(data['X'],likelihood=likelihood,inducing=inducing,ep_proxy=model_type)
|
||||
|
||||
|
||||
m.constrain_positive('var')
|
||||
m.constrain_positive('len')
|
||||
|
|
|
|||
39
GPy/examples/ep_fix.py
Normal file
39
GPy/examples/ep_fix.py
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
# Copyright (c) 2012, GPy authors (see AUTHORS.txt).
|
||||
# Licensed under the BSD 3-clause license (see LICENSE.txt)
|
||||
|
||||
|
||||
"""
|
||||
Simple Gaussian Processes classification
|
||||
"""
|
||||
import pylab as pb
|
||||
import numpy as np
|
||||
import GPy
|
||||
pb.ion()
|
||||
|
||||
default_seed=10000
|
||||
|
||||
model_type='Full'
|
||||
inducing=4
|
||||
seed=default_seed
|
||||
"""Simple 1D classification example.
|
||||
:param model_type: type of model to fit ['Full', 'FITC', 'DTC'].
|
||||
:param seed : seed value for data generation (default is 4).
|
||||
:type seed: int
|
||||
:param inducing : number of inducing variables (only used for 'FITC' or 'DTC').
|
||||
:type inducing: int
|
||||
"""
|
||||
data = GPy.util.datasets.toy_linear_1d_classification(seed=seed)
|
||||
likelihood = GPy.inference.likelihoods.probit(data['Y'][:, 0:1])
|
||||
|
||||
m = GPy.models.GP_EP2(data['X'],likelihood)
|
||||
|
||||
#m.constrain_positive('var')
|
||||
#m.constrain_positive('len')
|
||||
#m.tie_param('lengthscale')
|
||||
m.approximate_likelihood()
|
||||
# Optimize and plot
|
||||
#m.optimize()
|
||||
#m.em(plot_all=False) # EM algorithm
|
||||
m.plot()
|
||||
|
||||
print(m)
|
||||
Loading…
Add table
Add a link
Reference in a new issue