public MainWindow() { InitializeComponent(); Drawer pen = new Drawer(predictionChart); Drawer pen2 = new Drawer(predictionChart2); Drawer pen3 = new Drawer(predictionChart3); List <double> vs = new List <double>(); for (int i = 0; i < 30; i++) { vs.Add(Math.Sin(i)); } pen.DrawLinerChart(vs.ToArray(), "Pred"); var pred = PredictionUpdate.Prediction(vs, 20, true); pen.DrawLinerChart(pred.ToArray(), "Pred"); MainData mainData = new MainData(); mainData.Load_TXT("Сетевые-атаки(кол-во).txt"); var pred2 = PredictionUpdate.Prediction(mainData.GetData().ToList(), 0, true); pen3.DrawLinerChart(pred2.ToArray(), "pred"); pen3.DrawLinerChart(mainData.GetData(), "main"); MainData mainData2 = new MainData(); mainData2.Load_TXT("Сетевые-атаки.txt"); var pred3 = PredictionUpdate.Prediction(mainData2.GetData().ToList(), 0, true); pen2.DrawLinerChart(pred3.ToArray(), "pred"); pen2.DrawLinerChart(mainData2.GetData(), "main"); }
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; }
public static void GetPredictionPoly(CartesianChart cc, double[] data, int x, int y, int number, bool darbin, string dn, string dv) { 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 = PredictionUpdate.Prediction(buffer.ToList(), number, darbin, Convert.ToDouble(dn.Replace(".", ",")), Convert.ToDouble(dv.Replace(".", ","))).ToArray(); arr_data = arr_analitics; pen.DrawLinerChart(arr_analitics.Skip(buffer.Length - 1).ToArray(), y, "Прогноз"); Darbins = PredictionUpdate.darbins; }