Exemplo n.º 1
0
        public void GetErrorsOutputSignal()
        {
            //Arrange
            float[][] outputSignal = new float[][]
            {
                new float[] { 1 },
                new float[] { 0 },
                new float[] { 0 },
                new float[] { 1 }
            };

            float[][] actualSignal = new float[][]
            {
                new float[] { 1 },
                new float[] { 0 },
                new float[] { 0 },
                new float[] { 1 }
            };

            float[][] expected = new float[][]
            {
                new float[] { 0 },
                new float[] { 0 },
                new float[] { 0 },
                new float[] { 0 }
            };

            //Act
            var actual = NeuralMath.GetTotalLoss(outputSignal, actualSignal, LossFunc.MSE);

            //Assert
            for (int i = 0; i < expected.Length; i++)
            {
                for (int j = 0; j < expected[i].Length; j++)
                {
                    Assert.AreEqual(expected[i][j], actual);
                }
            }
        }
Exemplo n.º 2
0
        public float CalculateError(float[][] inputSignals, float[][] expectedSignals)
        {
            var _outputSignals = OnActivationNeuralNet(inputSignals).OutputsSignalsPrevLayer;

            return(NeuralMath.GetTotalLoss(_outputSignals, expectedSignals, LossFunc));
        }