Пример #1
0
        public void IamaxTest()
        {
            var xf = new[] { 1.0f, -2.0f, 5.0f, 12.0f };
            var xd = new[] { 1.0, -2.0, 5.0, 12.0, -3.0 };

            Assert.AreEqual(3, Blas1.iamax(xf.Length, xf, 1));
            Assert.AreEqual(3, Blas1.iamax(xd.Length, xd, 1));
        }
Пример #2
0
        public static void ClusteringTest(Network network, DataSet.DataSet data)
        {
            var correct = 0.0f;
            var count   = 0.0f;

            WriteLine("Testing.");
            Write($"Success Rate : {0.0f:##0.00%}");
            foreach (var datum in data.TestData())
            {
                count += 1.0f;
                network.SetInputs(datum.Input);
                network.ForwardPropagation();
                var maxIdx = Blas1.iamax(network.Output.Length, network.Output, 1);
                if (maxIdx == Blas1.iamax(datum.Output.Length, datum.Output, 1))
                {
                    correct += 1.0f;
                }
                Write($"\rSuccess Rate : {correct / count:##0.00%}");
            }
            WriteLine();
        }