Watch this video by Prof Rob https://www.youtube.com/watch?v=1Lh1HlBUf8k
In the video, Prof Rob taught regarding the accuracy function and the differences between in sample accuracy and out of sample accuracy.
i.e: Taking say 80-90% of your data, fit a model, forecast. Then check accuracy using the forecasted data with the 10% (since we have the actual value of your 10% data, we can check the out of sample accuracy of the model )
As well as refer to the online textbook in otext
Like other mentioned, when we compare models vs models, we use the accuracy() to compare with the test set. Then you can have various error measure like MAE, MSE, RMSE... etc which are used to compare models vs models