In the context of predicting stock prices with a requirement that the predicted price should not deviate more than 10% from the actual price, you would typically use a regression evaluation metric that accounts for the percentage error or relative error rather than a traditional metric like Mean Squared Error (MSE) or Mean Absolute Error (MAE). A suitable metric for this scenario could be the Mean Absolute Percentage Error (MAPE) or a related metric.
Mean Absolute Percentage Error (MAPE):
MAPE is a commonly used metric for measuring the accuracy of predictions when dealing with percentage errors. It calculates the average percentage difference between predicted and actual values. The formula for MAPE is as follows:
[ MAPE = \frac{1}{n} \sum_{i=1}^{n} \left| \frac{A_i - P_i}{A_i} \right| \times 100]
Where:
- ( A_i ) is the actual stock price at time ( i ).
- ( P_i ) is the predicted stock price at time ( i ).
- ( n ) is the total number of data points.
In this case, you would calculate MAPE for each prediction over the next 8 hours and ensure that the average MAPE remains below 10% to meet your requirement of not deviating more than 10% from the actual prices.
Using MAPE or a similar percentage-based metric is appropriate because it accounts for relative errors, which is important when dealing with financial data like stock prices. Traditional metrics like MSE or MAE may not capture the magnitude of the error relative to the actual price, which is crucial in financial forecasting.
Keep in mind that achieving a low MAPE may be challenging in predicting stock prices, as stock markets are inherently volatile and influenced by numerous unpredictable factors. It's essential to carefully design your prediction model and consider various features and techniques, such as time series analysis, feature engineering, and possibly using additional data sources, to improve the accuracy of your stock price predictions.