Comments (2)
Sorry for the late reply, I only noticed the issue when receiving the notification that you closed it.
regression_forecast_optimize() will returns the best settings for the autoregression.
For example: { MSE: 0.05086675645862624, method: 'ARMaxEntropy', degree: 4, sample: 20 }
To forecast a point, you then need to apply the auto-regression:
// Calculate the AR coefficients of the 10 previous points
var coeffs = t.ARMaxEntropy({
data: t.data.slice(0,20) // regression_forecast_optimize() give you the number of sample to use
});
// Output the coefficients to the console
console.log(coeffs);
// Calculate the forecasted value of the 21th datapoint using the AR coefficients:
var forecast = 0; // Init the value at 0.
for (var i=0;i<coeffs.length;i++) { // Loop through the coefficients
forecast -= t.data[20-i][1]*coeffs[i];
// Explanation for that line:
// t.data contains the current dataset, which is in the format [ [date, value], [date,value], ... ]
// For each coefficient, we substract from "forecast" the value of the "N - x" datapoint's value, multiplicated by the coefficient, where N is the last known datapoint value, and x is the coefficient's index.
}
console.log("forecast",forecast);
// Output: 92.7237232432106
sliding_regression_forecast() is creating a sliding window on a dataset, forecasting the next value so that the accuracy can be compared once the forecast and the actual data are charted.
It's not really meant to forecast the next point, it's more for validation of a model.
If you were using it to forecast the next point, then that point would be the last data in the dataset, but you'd have calculated the forecast for all the previous points also, which is a waste of processing power.
from timeseries-analysis.
Thanks!
from timeseries-analysis.
Related Issues (16)
- Pure Javascript implementation? HOT 2
- coeffs NaN HOT 5
- Method author? HOT 2
- Forecasting data form existing data set. HOT 4
- google chart url broken HOT 1
- From mongoose, get date from nested element
- anyupdates HOT 4
- coeffs [null,null,null,null,null] HOT 3
- Forecasting Data HOT 3
- Feature request: MA for time period even if data is missing HOT 3
- Returning NAN after length of indicator.
- Reference for smoother() HOT 2
- Request to make forecasting new values feature work
- Timeseries Analysis Version 2
- [feature] configure graph type
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from timeseries-analysis.