Skip to content
close×

Data Prediction

Data Prediction

Steema Numerics sets up the variables required for the prediction including the best guess Window size. Steema.Numerics uses MSE, wiki/Mean_squared_error, to check the most appropriate window size for the profile of the data and apply them to ML.Net's SSA forecasting analysis. See SSA for more detail on Singular Spectrum Analysis.

Using Steema.Numeric's Data Prediction for your TeeChart Series

Add references to Steema.Numerics

Include Steema.Numerics dependencies in your application project: - Steema.Numerics - Steema.Numerics.ChartHelper - Steema.Numerics.Windows

Steema.Numerics may be referenced via Nuget.

Call the Predictive algorithm

Steema.Numerics runs a series of predictive tests against the data with different Windowsizes and checks the best MSE fit to select which Windowsize to use. The predictions include timerange x,y values including the upper and lower confidence levels.

  1. Add three Series to you chart to 'house/show' the Predictions and the Upper/Lower Confidence bounds. These would typically be a Line or Point Series. You will already have the data series that contains the data itself, in the chart.
  2. Get the default prediction parameters and setup a PredictionResult set to hold the analysis when run.
    var predictionData = _predictionEditor.GetPredictionData();
    
    PredictionResult predictions = null;
    predictions = TeeChartHelper.Predictions_FromSeries(_series1, predictionData);
    
  3. Upon a result, the predictions are checked for their MSE values to set the bestWindowSize. The result is returned for the XValues to be calculated for the predicted YValues.
    xvals = _series1.XValues.Value.Take(_series1.Count).TakeLast(predictionData.Horizon).ToList();
    
  4. Once calculated the prediction can be added to the plot.
    TeeChartHelper.Add_Predictions(_series1, _series3, _series4, _series5, predictions, xvals);
    //respectively data_series, prediction_series, lower_bound_series, upper_bound_series, 
    //prediction_input, xvalues_for_the_prediction