Esempio n. 1
0
        private KerasSymbol _Call(KerasSymbol x)
        {
            switch (activation)
            {
            case "elu":
                return(Activations.Elu(x));

            case "exp":
                return(Activations.Exponential(x));

            case "hard_sigmoid":
                return(Activations.HardSigmoid(x));

            case "linear":
                return(Activations.Linear(x));

            case "relu":
                return(Activations.Relu(x));

            case "selu":
                return(Activations.Selu(x));

            case "sigmoid":
                return(Activations.Sigmoid(x));

            case "softmax":
                return(Activations.Softmax(x));

            case "softplus":
                return(Activations.Softplus(x));

            case "softsign":
                return(Activations.Softsign(x));

            case "tanh":
                return(Activations.Tanh(x));

            default:
                break;
            }

            return(Activations.Linear(x));
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            var X = Matrix <double> .Build.Random(5, 100);

            var Y = Matrix <double> .Build.Random(1, 100);

            var test = Matrix <double> .Build.Random(5, 1);


            var model = new DeepCat();

            model.Add(new Dense(5, Activations.Relu(), weightInitializer: Initializations.RandomNormal()));
            model.Add(new Dense(5, Activations.Relu(), weightInitializer: Initializations.RandomNormal()));
            model.Add(new Dense(1, Activations.Sigmoid()));

            model.Compile(X.RowCount, LossFunctions.CrossEntropy(), Optimizers.GradientDescent(0.002));

            model.Fit(X, Y, 100);
            model.Predict(test);



            var x = 1;
        }