Example #1
0
 def continuous_loss(self, y, y_hat):
     # continuous version of the loss
     # y is the result of linear programming
     mask = y != self.void_label
     return (GraphCRF.continuous_loss(self, y[mask], y_hat[mask])
             + np.sum(y_hat == self.void_label) / y.size)
 def continuous_loss(self, y, y_hat):
     # continuous version of the loss
     # y is the result of linear programming
     mask = y != self.void_label
     return (GraphCRF.continuous_loss(self, y[mask], y_hat[mask]) +
             np.sum(y_hat == self.void_label) / y.size)