mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-09 03:52:39 +02:00
Small changes to 1vsAll
This commit is contained in:
parent
b2885e1882
commit
76eb36f13c
1 changed files with 6 additions and 4 deletions
|
|
@ -2,11 +2,13 @@
|
||||||
# Licensed under the BSD 3-clause license (see LICENSE.txt)
|
# Licensed under the BSD 3-clause license (see LICENSE.txt)
|
||||||
|
|
||||||
from ..core import GP
|
from ..core import GP
|
||||||
|
from . import SparseGPClassification
|
||||||
from .. import likelihoods
|
from .. import likelihoods
|
||||||
from .. import kern
|
from .. import kern
|
||||||
from ..inference.latent_function_inference.expectation_propagation import EP
|
from ..inference.latent_function_inference.expectation_propagation import EP
|
||||||
|
import numpy as np
|
||||||
|
|
||||||
class OneVsAllClassification(GP):
|
class OneVsAllClassification(object):
|
||||||
"""
|
"""
|
||||||
Gaussian Process classification: One vs all
|
Gaussian Process classification: One vs all
|
||||||
|
|
||||||
|
|
@ -20,7 +22,7 @@ class OneVsAllClassification(GP):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, X, Y, kernel=None,Y_metadata=None):
|
def __init__(self, X, Y, kernel=None,Y_metadata=None,messages=True):
|
||||||
if kernel is None:
|
if kernel is None:
|
||||||
kernel = kern.RBF(X.shape[1])
|
kernel = kern.RBF(X.shape[1])
|
||||||
|
|
||||||
|
|
@ -36,6 +38,6 @@ class OneVsAllClassification(GP):
|
||||||
Ynew[Y.flatten()!=yj] = 0
|
Ynew[Y.flatten()!=yj] = 0
|
||||||
Ynew[Y.flatten()==yj] = 1
|
Ynew[Y.flatten()==yj] = 1
|
||||||
|
|
||||||
m = GPy.models.GPClassification(X,Ynew,kernel=kernel,Y_metadata=Y_metadata,inference_method=inference_method)
|
m = SparseGPClassification(X,Ynew,kernel=kernel,Y_metadata=Y_metadata)
|
||||||
m.optimize()
|
m.optimize(messages=messages)
|
||||||
self.results[yj] = m.predict(X)
|
self.results[yj] = m.predict(X)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue