public static KerasSymbol MeanSquaredLogrithmicError(KerasSymbol y_true, KerasSymbol y_pred) { var first_log = K.Log(K.Clip(y_pred, K.Epsilon(), null) + 1); var second_log = K.Log(K.Clip(y_true, K.Epsilon(), null) + 1); return(K.Mean(K.Square(first_log - second_log), axis: -1)); }
public override KerasSymbol Call(KerasSymbol w) { var norms = K.Sqrt(K.Sum(K.Square(w), axis: this.axis, keepdims: true)); var desired = K.Clip(norms, 0, this.max_value); w *= desired / (K.Epsilon() + norms); return(w); }
public static KerasSymbol KullbackLeiblerDivergence(KerasSymbol y_true, KerasSymbol y_pred) { y_true = K.Clip(y_true, K.Epsilon(), 1); y_pred = K.Clip(y_pred, K.Epsilon(), 1); return(K.Sum(y_true * K.Log(y_true / y_pred), axis: -1)); }
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)); }