Exemplo n.º 1
0
        public void Test()
        {
            testData = new DataSetReader(Parameter.TestingFile, Parameter.InputSize,
                                         Parameter.TargetSize);

            outputData = new DataSetWriter(Parameter.OutputFile, false,
                                           Parameter.InputSize, Parameter.TargetSize);

            double[] data1  = new double[Parameter.InputSize];   // Original data from dataset file.
            double[] data2  = new double[Parameter.InputSize];   // Temporaly transformed data (from data1).
            double[] target = new double[Parameter.TargetSize];
            double[] output = new double[1];
            while (testData.Read(data1, target))
            {
                // transform input level 1
                for (int i = 0; i < Parameter.InputSize; i++)
                {
                    data2[i] = inputTransformers1[i].TransformToValue(data1[i]);
                }
                // transform input level 2
                double[] dataInput = inputTransformers2.TransformToDimension(data2);

                if (Parameter.Mode == ProcessModifiedHybridFuzzyARTMapMode.EXTERNAL)
                {
                    fartmap.Run(dataInput);
                    output[0] = outputTransformers.TransformToValue(fartmap.Output);
                }
                else
                {
                    mfartmap.Run(dataInput);
                    output[0] = outputTransformers.TransformToValue(mfartmap.Output);
                }
                outputData.Write(data1, output, target);

                if (((int)output[0]) != 0)
                {
                    if (((int)output[0]) == ((int)target[0]))
                    {
                        performanceCounter.RightIncrement();
                    }
                    else
                    {
                        performanceCounter.WrongIncrement();
                    }
                }
                else
                {
                    performanceCounter.NonPredictIncrement();
                }
            }
            outputData.Close();
        }
Exemplo n.º 2
0
        public void TestWrite()
        {
            double[] dataBuffer = new double[] { 1.5 , 2.399 , 3.1234, 4.0555, 5.01111 };
            double[] testBuffer = new double[] { 6.0 };

            DataSetWriter dwr = new DataSetWriter(FILENAME, false, 5, 1);
            for (int i = 0; i < 3; ++i)
            {
                dwr.Write(dataBuffer, testBuffer, testBuffer);
            }
            dwr.Close();

            DataSetReader dsr = new DataSetReader(FILENAME, 5, 1);
            for (;dsr.Read(dataBuffer, testBuffer);) ;

            Assert.AreEqual(3, dsr.Count);
        }
Exemplo n.º 3
0
        public void Test()
        {
            Performance.Reset();

            testData = new DataSetReader(Parameter.TestingFile, Parameter.InputSize,
                                         Parameter.TargetSize);
            outputData = new DataSetWriter(Parameter.OutputFile, false,
                                           Parameter.InputSize, Parameter.TargetSize);

            double[] data1  = new double[Parameter.InputSize];   // Original data from dataset file.
            double[] data2  = new double[Parameter.InputSize];   // Temporaly transformed data (from data1).
            double[] target = new double[Parameter.TargetSize];
            double[] output = new double[1];
            while (testData.Read(data1, target))
            {
                // transform input level 1
                for (int i = 0; i < Parameter.InputSize; i++)
                {
                    data2[i] = inputTransformers1[i].TransformToValue(data1[i]);
                }
                // transform input level 2
                double[] dataInput = inputTransformers2.TransformToDimension(data2);

                network.Run(dataInput);
                output[0] = outputTransformers.TransformToValue(network.Output);
                outputData.Write(data1, output, target);

                if (Math.Round(output[0], 1) == Math.Round(target[0], 1))
                {
                    performanceCounter.RightIncrement();
                }
                else
                {
                    performanceCounter.WrongIncrement();
                }
            }
            outputData.Close();
        }
        public void Test()
        {
            Performance.Reset();

            testData = new DataSetReader(Parameter.TestingFile, Parameter.InputSize,
                Parameter.TargetSize);
            outputData = new DataSetWriter(Parameter.OutputFile, false,
                Parameter.InputSize, Parameter.TargetSize);

            double[] data1 = new double[Parameter.InputSize];    // Original data from dataset file.
            double[] data2 = new double[Parameter.InputSize];    // Temporaly transformed data (from data1).
            double[] target = new double[Parameter.TargetSize];
            double[] output = new double[1];
            while (testData.Read(data1, target))
            {
                // transform input level 1
                for (int i = 0; i < Parameter.InputSize; i++)
                {
                    data2[i] = inputTransformers1[i].TransformToValue(data1[i]);
                }
                // transform input level 2
                double[] dataInput = inputTransformers2.TransformToDimension(data2);

                network.Run(dataInput);
                output[0] = outputTransformers.TransformToValue(network.Output);
                outputData.Write(data1, output, target);

                if (Math.Round(output[0], 1) == Math.Round(target[0], 1))
                    performanceCounter.RightIncrement();
                else
                    performanceCounter.WrongIncrement();
            }
            outputData.Close();
        }
        public void Test()
        {
            testData = new DataSetReader(Parameter.TestingFile, Parameter.InputSize,
                Parameter.TargetSize);

            outputData = new DataSetWriter(Parameter.OutputFile, false,
                Parameter.InputSize, Parameter.TargetSize);

            double[] data1 = new double[Parameter.InputSize];    // Original data from dataset file.
            double[] data2 = new double[Parameter.InputSize];    // Temporaly transformed data (from data1).
            double[] target = new double[Parameter.TargetSize];
            double[] output = new double[1];
            while (testData.Read(data1, target))
            {
                // transform input level 1
                for (int i = 0; i < Parameter.InputSize; i++)
                {
                    data2[i] = inputTransformers1[i].TransformToValue(data1[i]);
                }
                // transform input level 2
                double[] dataInput = inputTransformers2.TransformToDimension(data2);

                if (Parameter.Mode == ProcessModifiedHybridFuzzyARTMapMode.EXTERNAL)
                {
                    fartmap.Run(dataInput);
                    output[0] = outputTransformers.TransformToValue(fartmap.Output);
                }
                else
                {
                    mfartmap.Run(dataInput);
                    output[0] = outputTransformers.TransformToValue(mfartmap.Output);
                }
                outputData.Write(data1, output, target);

                if (((int)output[0]) != 0)
                {
                    if (((int)output[0]) == ((int)target[0]))
                        performanceCounter.RightIncrement();
                    else
                        performanceCounter.WrongIncrement();
                }
                else
                {

                    performanceCounter.NonPredictIncrement();
                }
            }
            outputData.Close();
        }