Ejemplo n.º 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"));
        }
Ejemplo n.º 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"));
        }
Ejemplo n.º 3
0
        private static Symbol Poisson(Symbol preds, Symbol labels)
        {
            Symbol loss = OperatorSupply.Mean(preds - labels * OperatorSupply.Log(preds + float.Epsilon));

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