示例#1
0
        public static void GetAnaliticsPoly(CartesianChart cc, DataGrid dgv, double[] data, int x, int y)
        {
            _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 = analitics.GetPolyPrediction(buffer, 0);

            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;
        }
示例#2
0
        public static void GetPredictionPoly(CartesianChart cc, double[] data, int x, int y, int number)
        {
            if (analitics == null)
            {
                MessageBox.Show("Вы не проанализировали временной ряд.");
                return;
            }
            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.GetPolyPrediction(buffer, number);
            arr_data = arr_analitics;
            pen.DrawLinerChart(arr_analitics, x, "Аналитика");
        }