You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+22Lines changed: 22 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -319,6 +319,28 @@ Based on the value of the first 10 datapoints of the sin wave, out forecast indi
319
319
320
320
As we can see on the chart, the 11th datapoint's value seems to be around 92, as was forecasted.
321
321
322
+
We can also use `regression_forecast` method, which will using regression to forecast n datapoints based on defined sample from dataset. For resulting forecast datapoint same as above, we will first define the options:
323
+
```
324
+
var options = {
325
+
n: 1, // How many data points to be forecasted
326
+
sample: 10, // How many datapoints to be training dataset
327
+
start: 11, // Initial forecasting position
328
+
// method: "ARMaxEntropy", // What method for forecasting
329
+
// degree: 5, // How many degree for forecasting
330
+
// growthSampleMode: false, // Is the sample use only last x data points or up to entire data points?
331
+
}
332
+
```
333
+
334
+
Now, we generate the regression forecast on the data, then it resulted the MSE & trained data:
335
+
```
336
+
var MSE = t.regression_forecast(options)
337
+
338
+
console.log(MSE) // 0.000022902164211893183
339
+
console.log(t.data[10][1]) // 93.97404769915791
340
+
```
341
+
342
+
Based on the value of the first 10 datapoints of the sin wave, out forecast indicates the 11th value is 93.97404769915791. This interesting because the 11th observed real datapoint value is 93.96926207859084, which means it seems as was forecasted.
343
+
322
344
323
345
#### Forecast accuracy ####
324
346
In order to check the forecast accuracy on more complex data, you can access the `sliding_regression_forecast` method, which will use a sliding window to forecast all of the datapoints in your dataset, one by one. You can then chart this forecast and compare it t the original data.
0 commit comments