Example #1
0
        public override KerasSymbol Call(KerasSymbol x)
        {
            KerasSymbol regularization = null;

            if (this.l1 > 0)
            {
                regularization += K.Sum(this.l1 * K.Abs(x), null);
            }
            if (this.l2 > 0)
            {
                regularization += K.Sum(this.l2 * K.Square(x), null);
            }

            return(regularization);
        }
Example #2
0
        public static KerasSymbol MeanAbsolutePercentageError(KerasSymbol y_true, KerasSymbol y_pred)
        {
            var diff = K.Abs((y_true - y_pred) / K.Clip(K.Abs(y_true), K.Epsilon(), null));

            return(100 * K.Mean(diff, axis: -1));
        }
Example #3
0
 public static KerasSymbol MeanAbsoluteError(KerasSymbol y_true, KerasSymbol y_pred)
 {
     return(K.Mean(K.Abs(y_pred - y_true), axis: -1));
 }