示例#1
0
 def cost(X, y, beta):
     '''
     :params: X: N x D
     :params: y: D x 1
     :params: beta: weights D x 1 
     '''
     return loss.hinge(X, y, beta)
示例#2
0
 def cost(self, X, y, beta, b):
     '''
     Hinge loss function
     --------------------
     :params: X: feature space
     :params: y: target
     :params: beta: weights parameters.
     '''
     return 0.5 * beta.dot(beta) + self.C * np.sum(loss.hinge(X, y, beta, b))
示例#3
0
 def activation(X, y, beta):
     '''
     :params: X: train data
     :params: X: weights
     '''
     return 1 if loss.hinge(X, y, beta) > 0 else 0