Decode() public method

Decode a set of activations and see which set it has the lowest Euclidean distance from.
public Decode ( double activations ) : int
activations double The output from the neural network.
return int
        public static void Evaluate(FileOps fileOps)
        {
            var network = (BasicNetwork) EncogDirectoryPersistence.LoadObject(fileOps.TrainedNeuralNetworkFile);
            var analyst = new EncogAnalyst();
            analyst.Load(fileOps.AnalystFile);
            var evaluationSet = EncogUtility.LoadCSV2Memory(fileOps.NormalisedEvaluationFile.ToString(),
                network.InputCount, network.OutputCount, true, CSVFormat.English, false);
            var iteration = 0;
            var hitCount = 0;
            foreach (var evaluation in evaluationSet)
            {
                iteration++;
                var output = network.Compute(evaluation.Input);

                var sepalL = analyst.Script.Normalize.NormalizedFields[0].DeNormalize(evaluation.Input[0]);
                var sepalW = analyst.Script.Normalize.NormalizedFields[0].DeNormalize(evaluation.Input[1]);
                var petalL = analyst.Script.Normalize.NormalizedFields[0].DeNormalize(evaluation.Input[2]);
                var petalW = analyst.Script.Normalize.NormalizedFields[0].DeNormalize(evaluation.Input[3]);

                var classCount = analyst.Script.Normalize.NormalizedFields[4].Classes.Count;

                var normalisationHigh = analyst.Script.Normalize.NormalizedFields[4].NormalizedHigh;
                var normalisationLow = analyst.Script.Normalize.NormalizedFields[4].NormalizedLow;

                var eq = new Equilateral(classCount, normalisationHigh, normalisationLow);
                var predictedClassInt = eq.Decode(output);
                var predictedClass = analyst.Script.Normalize.NormalizedFields[4].Classes[predictedClassInt].Name;
                var idealClassInt = eq.Decode(evaluation.Ideal);
                var idealClass = analyst.Script.Normalize.NormalizedFields[4].Classes[idealClassInt].Name;

                Console.WriteLine("Predicted: {0} Ideal: {1}",predictedClass,idealClass);
                if (predictedClass == idealClass)
                {
                    hitCount++;
                }

            }
            Console.WriteLine("Total Test Count:{0}",iteration);
            Console.WriteLine("Total Correct Predictions: {0}",hitCount);
            Console.WriteLine("Success rate: {0}%", (((float)hitCount/(float)iteration)*100f));
            Console.ReadKey();
        }
 public int DenormalizeYear(double[] days, int MaxYear)
 {
     var eq = new Equilateral(MaxYear, -1, 1);
     return eq.Decode(days);
 }
 public int DenormalizeSeconds(double[] seconds)
 {
     var eq = new Equilateral(60, -1, 1);
     return eq.Decode(seconds);
 }
 public int DenormalizeMonth(double[] montharry)
 {
     var eq = new Equilateral(12, -1, 1);
     return eq.Decode(montharry);
 }
 public int DenormalizeHour(double[] hour)
 {
     var eq = new Equilateral(24, -1, 1);
     return eq.Decode(hour);
 }
 public int DenormalizeDays(double[] days)
 {
     var eq = new Equilateral(31, -1, 1);
     return eq.Decode(days);
 }
 public static int DenormalizeYear(double[] year)
 {
     var eq = new Equilateral(2011, -1, 1);
     return eq.Decode(year);
 }
        public void TestDateNormalizeDaysEncode()
        {
            var eq = new Equilateral(DateTime.DaysInMonth(2012, 1), -1, 1);
            var encoded = eq.Encode(15);
            StringBuilder b = new StringBuilder(encoded.Length);
            for (int i = 0; i < encoded.Length; i++)
            {
                if (i < encoded.Length - 1)
                    b.Append(encoded[i] + ",");
                else b.Append(encoded[i]);
            }
            Console.WriteLine("Encoded 15 to Equilaterable " + b.ToString());
            Assert.IsNotNull(encoded, "Encoded is not null");
            Assert.IsTrue(encoded[14].ToString() == "-0.984250984251476");
            //Now we get the day back..

            int res = eq.Decode(encoded);
            Console.WriteLine("Result decode == " + res);
            Assert.AreEqual(15, res, "Decoded back to 15");
        }