private void Current_Data_btn_Click(object sender, RoutedEventArgs e)
        {//show the user the current data we will use for forcasting from the hashtag file the user choose
            if (check_user_input(1))
            {
                Popup.IsOpen = false;

                //clear the charts if it has points alrady
                Current_Data.Clear();
                Next_Data.Clear();
                Predicted_Data.Clear();
                Negetive_Predicted_Data.Clear();

                //create the arff data file from 90% of the current data from the hashtag that the user choose
                //and save in arff.next_data an array with the next data point (the last 10% of the current data)
                SignalToSignalArff arff = new SignalToSignalArff("D:\\Twist_DB\\hashtag_signal\\" + listBox.SelectedItem.ToString() + ".txt", data_precentage_split);

                //fill the next data points to the next_data prop
                if (arff.next_data != null)
                {
                    next_data = new Tuple <double, double> [arff.next_data.Length];
                    next_data = arff.next_data;
                }

                //fixing chart prespective
                Next_Data.Add(new ObservablePoint(0, 0));
                Predicted_Data.Add(new ObservablePoint(0, 0));
                Negetive_Predicted_Data.Add(new ObservablePoint(0, 0));

                // path to the signal data - found in the project folder ..WekaForecasting\bin\Debug
                String pathToData = ".\\Signal.arff";

                // load the signal data
                Instances data = new Instances(new java.io.BufferedReader(new java.io.FileReader(pathToData)));

                //fill  Current_Data series with the data from the hashtag file the user choose
                for (int i = 0; i < data.numInstances(); i++)
                {
                    Current_Data.Add(new ObservablePoint(data.instance(i).value(0), data.instance(i).value(1)));
                }
            }
        }
        private void Forecast_Calc_Fill()
        {//using WekaForcaster to culclate the predicted data for our current signal data.
         //and show it in a chart for the user
            try
            {
                // path to the signal data - found in the project folder ..WekaForecasting\bin\Debug
                String pathToData = ".\\Signal.arff";

                // load the signal data
                Instances data = new Instances(new java.io.BufferedReader(new java.io.FileReader(pathToData)));

                // new forecaster
                WekaForecaster forecaster = new WekaForecaster();

                // set the target we want to forecast - the attribute in our arff file.
                forecaster.setFieldsToForecast("frequency");

                // default underlying classifier is SMOreg (SVM) - we'll use
                // MultilayerPerceptron for regression instead
                forecaster.setBaseForecaster(new MultilayerPerceptron());

                // set the attribute in our arff file that will be our time stamp.
                forecaster.getTSLagMaker().setTimeStampField("time");

                // set the lag creation to the data
                forecaster.getTSLagMaker().setMinLag(1);
                forecaster.getTSLagMaker().setMaxLag(returnBestMaxLagFit(forecaster, data));


                // build the model
                forecaster.buildForecaster(data);

                // prime the forecaster with enough recent historical data
                forecaster.primeForecaster(data);

                //xFactor will help us to calculate the forecast data after the last data piont in the next_data
                int xFactor = next_data.Length;

                // forecast for the number of forecastUnits we set beyond the end of the training data
                int      forecastUnits = Convert.ToInt32(TextBox.Text) + xFactor;
                double[] PredectedList = new double[forecastUnits];
                var      mylist        = forecaster.forecast(forecastUnits);

                //get the forcasted data and place it in the PredectedList
                for (int i = 0; i < forecastUnits; i++)
                {
                    String predict = mylist.get(i).ToString().Split(' ')[2];
                    PredectedList[i] = Convert.ToDouble(predict);
                }

                //lag represent our fixed lag between the time stamp of the predictions
                double lag = forecaster.getTSLagMaker().getDeltaTime();

                //DeltaTime will represent our changing lag between each time stamp at each prediction
                double DeltaTime = 0;

                //getting the last time stamp in our last point in the current data
                double lastValidTime = data.lastInstance().value(0);

                //clear Predicted_Data if alredy have data inside
                Predicted_Data.Clear();
                Negetive_Predicted_Data.Clear();

                // output the predictions with their time stamp in the chart.
                for (int i = 0; i < forecastUnits; i++)
                {
                    if (i < next_data.Length - 1)
                    {//we still in the next data points and not in the predected points the user want to predict
                        Predicted_Data.Add(new ObservablePoint(next_data[i].Item1, PredectedList[i]));

                        //checks if the predected point is negetive if is negetive add the the black points series
                        if (PredectedList[i] < 0)
                        {
                            Negetive_Predicted_Data.Add(new ObservablePoint(next_data[i].Item1, PredectedList[i]));
                        }

                        //get the x from the last point in our next data to be the starting point in the predecred data
                        lastValidTime = next_data[i].Item1;
                    }
                    else
                    {//we are in the range of the predected points the user want to predict
                        //advance the current time to correspond to the forecasted values
                        DeltaTime = DeltaTime + lag;

                        //append the predicted data to the chart
                        Predicted_Data.Add(new ObservablePoint(lastValidTime + DeltaTime, PredectedList[i]));

                        //checks if the predected point is negetive if is negetive add the the black points series
                        if (PredectedList[i] < 0)
                        {
                            Negetive_Predicted_Data.Add(new ObservablePoint(lastValidTime + DeltaTime, PredectedList[i]));
                        }
                    }
                }

                //clear progressBar in the end of the progress
                ProgressBar.Value = 0;

                //checks if their wasn't negetive predected point and add the (0,0) point to the black points series
                //for preserving the chart prespective
                if (Negetive_Predicted_Data.Count == 0)
                {
                    Negetive_Predicted_Data.Add(new ObservablePoint(0, 0));
                }
            }
            catch (Exception ex) { ex.ToString(); }
        }