public unsafe double ProcessData(char *data, int size, string context)
        {
            if (!_allContexts.Contains(context))
            {
                throw new Exception(context + " context does not exist");
            }

            var arr = ByteArrToDoubleArr(data, size);

            Standardizer.ProcessCalculate(arr);

            double avg = 0;

            for (int i = 0; i < arr.Length; i++)
            {
                avg += arr[i];
            }
            avg /= arr.Length;
            Debug.WriteLine("Average: " + avg);

            double[] types = TypesValues(context);


            // Fourier.FFT(arr, FourierDirection.Forward);

            //double[] input = new double[arr.Length];
            //for(int i = 0; i < arr.Length; i++)
            //{
            //    input[i] = (double) arr[i].Re;
            //}

            double error;

            // int t;
            // do
            // {
            error = _learning.Run(arr, types);

            // t = TestData(data, size).Select(a => a).Where(a => a.Value >= 1 && a.Key.Equals(context)).Count();
            // } while (t < 1 && confirmGood);

            Debug.WriteLine("Data Error: " + error);
            return(error);
        }
        private double[] TypesValues(string context)
        {
            double[] types = new double[_allContexts.Count];
            for (int i = 0; i < types.Length; i++)
            {
                if (_allContexts[i] == context)
                {
                    types[i] = 1.0;
                }
                else
                {
                    types[i] = -1.0;
                }
            }

            Standardizer.ProcessCalculate(types);

            // types = NormalizeDouble(types);

            return(types);
        }
        public unsafe Dictionary <string, double> TestData(char *data, int size)
        {
            // var model = _teacher.Model;
            // var arr = ByteArrToComplexArr(data, size);
            // Fourier.FFT(arr, FourierDirection.Forward);

            //double[] input = new double[arr.Length];
            //for (int i = 0; i < arr.Length; i++)
            //{
            //    input[i] = (double)arr[i].Re;
            //}

            var input = ByteArrToDoubleArr(data, size);

            Standardizer.ProcessCalculate(input);

            double[] probabilities = _network.Compute(input);


            double total = 0;

            foreach (double probability in probabilities)
            {
                total += probability;
            }

            for (int i = 0; i < probabilities.Length; i++)
            {
                probabilities[i] = probabilities[i] / total;
            }



            return(_allContexts.Zip(probabilities, (k, v) => new { s = k, d = v })
                   .OrderBy((k) => k.d).Reverse().ToDictionary(key => key.s, value => value.d));
        }