Пример #1
0
        public static KerasSymbol CategorialHinge(KerasSymbol y_true, KerasSymbol y_pred)
        {
            var pos = K.Sum(y_true * y_pred, axis: -1);
            var neg = K.Max((1 - y_true) * y_pred, axis: -1);

            return(K.Maximum(0, neg - pos + 1));
        }
Пример #2
0
 public static KerasSymbol Hinge(KerasSymbol y_true, KerasSymbol y_pred)
 {
     return(K.Mean(K.Maximum(1 - y_true * y_pred, 0), axis: -1));
 }