Exemplo n.º 1
0
 def setData(self,x,y,*args,**kwargin):
     """set Data
     x: inputs [N,D]
     t: targets [N]
     - targets are either -1,+1 or False/True
     """
     assert isinstance(y,S.ndarray), 'setData requires numpy arrays'
     #check whether t is bool
     if y.dtype=='bool':
         y_ = S.ones([y.shape[0]])
         y_[y] = +1
         y_[~y] = -1
         y = y_
     else:
         assert len(SP.unique(y))==2, 'need either binary inputs or inputs of length 2 for classification'
     GPEP.setData(self,x=x,y=y,*args,**kwargin)
Exemplo n.º 2
0
 def setData(self, x, y, *args, **kwargin):
     """set Data
     x: inputs [N,D]
     t: targets [N]
     - targets are either -1,+1 or False/True
     """
     assert isinstance(y, S.ndarray), 'setData requires numpy arrays'
     #check whether t is bool
     if y.dtype == 'bool':
         y_ = S.ones([y.shape[0]])
         y_[y] = +1
         y_[~y] = -1
         y = y_
     else:
         assert len(
             SP.unique(y)
         ) == 2, 'need either binary inputs or inputs of length 2 for classification'
     GPEP.setData(self, x=x, y=y, *args, **kwargin)
Exemplo n.º 3
0
    def predict(self,*argin,**kwargin):
        """Binary classification prediction"""

        #1. get Gaussian prediction
        [MU,S2] = GPEP.predict(self,*argin,**kwargin)
        #2. push thorugh sigmoid
        #predictive distribution is int_-inf^+inf normal(f|mu,s2)sigmoid(f)
        Pt = sigmoid ( MU / S.sqrt(1+S2))
        return [Pt,MU,S2]
        pass
Exemplo n.º 4
0
    def predict(self, *argin, **kwargin):
        """Binary classification prediction"""

        #1. get Gaussian prediction
        [MU, S2] = GPEP.predict(self, *argin, **kwargin)
        #2. push thorugh sigmoid
        #predictive distribution is int_-inf^+inf normal(f|mu,s2)sigmoid(f)
        Pt = sigmoid(MU / S.sqrt(1 + S2))
        return [Pt, MU, S2]
        pass