How to predict values from machine learning model?

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 Kommentare

KSSV
KSSV am 21 Feb. 2024
What are your inputs and target? How did you train the data?
Manny
Manny am 21 Feb. 2024
One more thing...
MATLAB tells me to use yfit = trainedModel.predictFcn(T) for forecasting but I cannot figure out how to give it an array of dates I created above. Any help is much appreciated.
Manny
Manny am 21 Feb. 2024
Hi @KSSV. I entered what I showed in the first screenshot. I picked 'CIV' and then the app automatically picked the response and predictors. I only changed the training data field to 25. I used the learner app to train it.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Drew
Drew am 22 Feb. 2024
Bearbeitet: Drew am 22 Feb. 2024

0 Stimmen

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:
If this answer helps you, please remember to accept the answer.

Kategorien

Mehr zu Statistics and Machine Learning Toolbox finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 21 Feb. 2024

Bearbeitet:

am 22 Feb. 2024

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by