public static void GetAnaliticsMidle(CartesianChart cc, DataGrid dgv, double[] data, int x, int y, int number)
        {
            analitics = new PredictionM();
            Drawer pen = new Drawer(cc);

            var buffer_data = data.Skip(x).Take(y - x + 1);
            int count       = 0;

            double[] buffer = new double[y - x + 1];
            foreach (var item in buffer_data)
            {
                buffer[count] = Convert.ToDouble(item);
                count++;
            }

            double[] arr_analitics = analitics.GetMAPrediction(buffer, number);
            arr_data = arr_analitics;
            List <Darbin> table = new List <Darbin>();

            double error = 0;
            double sum   = 0;

            for (int i = 0; i < buffer.Length; i++)
            {
                sum += (Math.Abs(buffer[i] - arr_analitics[i]) / buffer[i]) * 100;
            }
            error = sum / buffer.Length;
            pen.DrawLinerChart(arr_analitics, x, "Аналитика");
            table.Add(new Darbin {
                N = "Средняя ошибка", D = Math.Round(error, 2)
            });
            dgv.ItemsSource = table;
        }
        public static void GetAnaliticsExp(CartesianChart cc, DataGrid dgv, double[] data, int x, int y, double error_need)
        {
            analitics = new PredictionM();
            Drawer pen = new Drawer(cc);

            var buffer_data = data.Skip(x).Take(y - x + 1);
            int count       = 0;

            double[] buffer = new double[y - x + 1];
            foreach (var item in buffer_data)
            {
                buffer[count] = Convert.ToDouble(item);
                count++;
            }

            double alfa  = 0.3;
            double error = 0;

            arr_analitics = analitics.GetExpPrediction(buffer, 0, alfa);
            //do
            //{

            //    double sum = 0;

            //    for (int i = 0; i < buffer.Length; i++)
            //    {
            //        sum += ((buffer[i] - arr_analitics[i])/ buffer[i]) * 100;
            //    }
            //    error = sum / buffer.Length;

            //    List<Darbin> table = new List<Darbin>();
            //    table.Add(new Darbin { N = alfa.ToString(), D = Math.Round(error, 2) });
            //    dgv.Items.Add(table);
            //    alfa += 0.1;

            //} while (error > error_need);
            pen.DrawLinerChart(arr_analitics, x, "Аналитика");
            Darbins = PredictionUpdate.darbins;
        }
        public static void GetAnaliticsPoly(CartesianChart cc, DataGrid dgv, double[] data, int x, int y, bool darbin, string dn, string dv, string countG)
        {
            _x        = x;
            analitics = new PredictionM();
            Drawer pen = new Drawer(cc);

            var buffer_data = data.Skip(x).Take(y - x + 1);
            int count       = 0;

            double[] buffer = new double[y - x + 1];
            foreach (var item in buffer_data)
            {
                buffer[count] = Convert.ToDouble(item);
                count++;
            }


            double[] arr_analitics = PredictionUpdate.Prediction(buffer.ToList(), 0, darbin, Convert.ToDouble(dn.Replace(".", ",")), Convert.ToDouble(dv.Replace(".", ",")), countG).ToArray();

            pen.DrawLinerChart(arr_analitics, x, "Аналитика");
            //List<Darbin> table = new List<Darbin>();
            //for (int i = 0; i < analitics.darbi.Length; i++)
            //{
            //    table.Add(new Darbin { N = (i + 1).ToString(), D = analitics.darbi[i] });
            //}
            double error = 0;
            double sum   = 0;

            for (int i = 0; i < buffer.Length; i++)
            {
                sum += (Math.Abs(buffer[i] - arr_analitics[i]) / buffer[i]) * 100;
            }
            error = sum / buffer.Length;

            //table.Add(new Darbin { N = "Средняя ошибка", D = Math.Round(error, 2) });
            //dgv.ItemsSource = table;
            Darbins = PredictionUpdate.darbins;
        }