training sample for time series

Hello

What is the best function for ML sampling of time series?

=>I use createTimeSlices() but don't understand how to organise dataset to plug in like time stamp? any example please? should i split like :training (year1-year5), testing(year6)?

Thank you.

ps. i could not find enough explanation here:4 Data Splitting | The caret Package

Please let me put it differently.

I want to run ML on time series. I would like to know what is the BEST sampling methodology (and R package) to adopt to improve the fitting process?

Thank you !!!

Hello, perhaps it is not clear enough. I just want to know your personal experience about which sampling function is best for Time Series? most of wht i read seems for cross section. Many thanks.

Hi @supermarco,
Just a couple of comments in case you haven't made progress on this.
The {caret} package does random sampling of datasets which is usually not appropriate for time series data. What you really need to do is model your data and then test the model's fit and/or use the model for forecasting. I found several useful articles and videos on this with a Google search: "testing forecast in time series in R".
Good luck.

Hello
Thanks a lot for your point. I did not progress so far. It's more complicated that what i felt but you are right about caret, the sampling approach does not fit time series. So i tried to cut the sample between past (training) and current (testing) but i m not satisfied with that, it looks naive. I will plug your key words in google to see more. Many thanks again !