Esempio 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();
        }
Esempio n. 2
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();
        }