I have run a machine learning model on my local machine and uploaded the historical prediction scores using the import stock factor function.
In testing it out in the screen, and I am trying to find a way for the screen to show me the date from the imported stock factor file from which it retrieves the prediction scores.
It displays prediction scores from the stock factor dataset with:
showvar (@FML, $$130624firstml)
How can we make it also show the date from the dataset for the specific prediction score?
Waycliff; In the code you posted you download P123’s data using:
data = dd.read_csv(file_path, parse_dates=['Date']).set_index('Date')
print("Columns before preprocessing:", data.columns)
Parsing the dates drops the dates from the downloaded data which you will need to link to the ML predictions after running your model.
Example, The data format of the downloaded data from P123 for a simplified toy example is:
'Date', 'P123 ID', 'Ticker', 'AvgRec', 'Beta 1Y', 'EBITDA _ EV', 'EpsAclLt', 'Future 3M%Chg'
But you are dropping the Date, P123 ID and Ticker by parsing at the beginning.
This only gives you the data columns you need for the models bun not the links to the tickers
You do need to drop these when you send data (Xtrain) and ytrain to the ML.
However you need to keep the original index, with the Date and Ticker matched to the index of the ytest data so that you can match that with the ypred results to link the pred values to the individual tickers being
Predicted.
Not sure I did a decent job of explaining but hope it helps.