How to predict values from machine learning model?
31 views (last 30 days)
Show older comments
Hi everyone
I am new to machine learning and MATLAB. I am not sure what I am doing wrong. I have a table of stock market data called CIV. The table has symbol, date, and CIV. See screenshot from workspace. I want to forecast by symbol and date. For example, for symbol ABC I want forecast for 10 days. For symbol DEF I want 10 day forecast. The underlying data for the symbols will be different b/c the symbols are different. Hopefully this makes sense. If not, I will clarify if needed. I was able to export the trainmodel. How do I tell it that I want to forecast 10 days starting from date X? I created an array of the dates to use for the forecast but I can't figure out how to use it. Here are the dates:
% CREATE ARRAY OF DATES THAT ARE USED FOR FORECASTING
T0 = datetime("today");
T1 = datetime(busdate(T0,1));
T2 = datetime(busdate(T1,1));
T3 = datetime(busdate(T2,1));
T4 = datetime(busdate(T3,1));
T5 = datetime(busdate(T4,1));
T6 = datetime(busdate(T5,1));
T7 = datetime(busdate(T6,1));
T8 = datetime(busdate(T7,1));
T9 = datetime(busdate(T8,1));
T10 = datetime(busdate(T9,1));
ForecastDates = [T1 T2 T3 T4 T5 T6 T7 T8 T9 T10];
Here is how I started the machine learning app:
Here is a screenshot of the variables in my workspace:
Thank you
3 Comments
Answers (1)
Drew
on 22 Feb 2024
Edited: Drew
on 22 Feb 2024
The Classification Learner app is not specifically designed for working with time series. To analyze time series, there are several options depending on the requirements of your use case. Here are some of the options:
- With the Statistics and Machine Learning Toolbox, apply machine learning techniques to time series using the directforecaster function introduced in R2023b https://www.mathworks.com/help/stats/perform-time-series-direct-forecasting-with-directforecaster.html
- With the Deep Learning Toolbox, use deep learning techniques for time series forecasting https://www.mathworks.com/help/deeplearning/ug/time-series-forecasting-using-deep-learning.html .
- With the System Identification toolbox, perform time series prediction and forecasting for prognosis https://www.mathworks.com/help/ident/ug/time-series-prediction-and-forecasting-for-prognosis.html
- With the Econometrics toolbox, analyze time series using the Econometric Modeler. https://www.mathworks.com/help/econ/econometric-modeler-overview.html
- Additional options for working with financial time series data can be found at https://www.mathworks.com/campaigns/offers/financial-time-series-cheat-sheets.html .
If this answer helps you, please remember to accept the answer.
0 Comments
See Also
Categories
Find more on Direct Forecasting in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!