Esempio n. 1
0
        public void Softmax_InPlace_Test()
        {
            var values = givenInput.ToArray();

            Assert.IsTrue(!object.ReferenceEquals(values, givenInput));
            NormalizationHelper.Softmax(values);
            double sum = 0;

            for (int i = 0; i < values.Length; i++)
            {
                double diff = Math.Abs(expectedOutput[i] - values[i]);
                Assert.IsTrue(diff < Math.Pow(10, -6));
                sum += values[i];
            }
            Assert.IsTrue(StatisticsHelper.IsApproximatelyEqual(sum, 1D));
        }