示例#1
0
        private static Symbol MeanAbsoluteLogError(Symbol preds, Symbol labels)
        {
            Symbol first_log  = OperatorSupply.Log(OperatorSupply.Clip(preds, float.Epsilon, 0) + 1);
            Symbol second_log = OperatorSupply.Log(OperatorSupply.Clip(labels, float.Epsilon, 0) + 1);
            Symbol loss       = OperatorSupply.Mean(OperatorSupply.Square(first_log - second_log));

            return(new Operator("MakeLoss").SetInput("data", loss).CreateSymbol("MeanAbsoluteLogError"));
        }
示例#2
0
        private static Symbol KullbackLeiblerDivergence(Symbol preds, Symbol labels)
        {
            Symbol y_true = OperatorSupply.Clip(labels, float.Epsilon, 1);
            Symbol y_pred = OperatorSupply.Clip(preds, float.Epsilon, 1);
            Symbol loss   = OperatorSupply.Sum(y_true * OperatorSupply.Log(y_true / y_pred));

            return(new Operator("MakeLoss").SetInput("data", loss).CreateSymbol("KullbackLeiblerDivergence"));
        }
示例#3
0
        private static Symbol MeanAbsolutePercentageError(Symbol preds, Symbol labels)
        {
            Symbol loss = OperatorSupply.Mean(OperatorSupply.Abs(labels - preds) / OperatorSupply.Clip(OperatorSupply.Abs(labels), float.Epsilon, 0));

            return(new Operator("MakeLoss").SetInput("data", loss).CreateSymbol("MeanAbsolutePercentageError"));
        }