コード例 #1
0
ファイル: Program.cs プロジェクト: Vilozio/Neuro-network
        void Proc2(Model model)
        {
            int learnIterations = 100;
            double desiredError = 0;

            var activationFunc1 = new ThresholdFunction();
            var activationFunc2 = new SigmoidFunction(1);
            IActivationFunction activationFunc = activationFunc2;
            int inputsCount = model.InputsCount;
            int[] neuronsCount = new int[3];
            neuronsCount[0] = model.InputsCount;
            neuronsCount[1] = model.InputsCount * 2;
            neuronsCount[2] = model.desiredOutput[0].Length;

            ActivationNetwork net = new ActivationNetwork(activationFunc, inputsCount, neuronsCount);
            BackPropagationLearning lerning = new BackPropagationLearning(net);
            ErrorCalculator errorCalculator = new ErrorCalculator();

            Process(learnIterations, desiredError, net, lerning,
                model.input, model.desiredOutput, errorCalculator);

            Console.ReadLine();
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: Vilozio/Neuro-network
        void Process(int learnIterations, double desiredError, 
                ActivationNetwork net, ISupervisedLearning lerning, 
                double[][] input, double[][] desiredOutput, 
                ErrorCalculator errorCalculator)
        {
            for (int i = 0; i < learnIterations; i++) {
                double[][] result = Compute(net, input);
                double error = errorCalculator.CalculateEpoch(desiredOutput, result);
                Console.WriteLine("{0}\t{1}", i, error);

                if (error < desiredError) break;
                lerning.RunEpoch(input, desiredOutput);
            }
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: Vilozio/Neuro-network
        void Proc1()
        {
            int learnIterations = 100;
            double desiredError = 0;

            Model model = getModelAnd();
            var activationFunc1 = new ThresholdFunction();
            var activationFunc2 = new SigmoidFunction(1);
            IActivationFunction activationFunc = activationFunc2;
            int inputsCount = model.InputsCount;
            int neuronsCount = 1;

            ActivationNetwork net = new ActivationNetwork(activationFunc, inputsCount, neuronsCount);
            PerceptronLearning lerning = new PerceptronLearning(net);
            ErrorCalculator errorCalculator = new ErrorCalculator();

            Process(learnIterations, desiredError, net, lerning,
                model.input, model.desiredOutput, errorCalculator);

            Console.ReadLine();
        }