3
$\begingroup$

I am trying to determine how to use machine learning models such as for eg., random Forest with (non-financial) time-series data.

Using an example, suppose we wanted to find based on monthly scores on subjects for each student how well he/she will do in a month-end exam that occurs every month.

Month 1 Data

Name    State  EngScore  MathScore  HistScore  ...  MonthEndExamScore
John    NY     80        90         75              180
Jack    TX     78        65         90              170
John    CA     82        93         79              185

The same data is collected for the students in Month 2, 3 ... n. The task is to predict the MonthEndExam score of the current month using the student's historical data on performance during previous months.

For the current month, the scores on all the individual subjects are known by mid-month, whereas the MonthEndExam is not known until the end of the month and it is what we would like to predict.

I understand that one could use statistical methods such as ARIMA, etc, but I was wondering if there were similar methods in ML that can be applied here, ** in particular ** using packages in R (such as randomForest, caret, party, etc).

Thanks in advance.

$\endgroup$
  • $\begingroup$ Just to be clear, my original dataset has over 400,000 rows ... and over ~ 50 columns per period. The above represents the problem in simpler terms. $\endgroup$ – xbsd Sep 28 '13 at 19:47
  • $\begingroup$ As I understand it, traditional methods in machine learning don't consider correlation between rows of features in the training set. However, that is the most salient feature in time series data. Obviously, you could omit it and see how well your algorithm does, but in some application this is not feasible. $\endgroup$ – Robert Smith Sep 28 '13 at 20:10
3
$\begingroup$

If you have the data and features already in a data frame, you can use caret's train function.

I added an option to trainControl that allows for cross-validation via different types of moving windows (thanks to Tony Cooper for contributing it). You would use trainControl(method = "timeSlice"), method = "horizon" or "method = initialWindow". See ?createTimeSlices for the function that does all of this.

These method are not well documented in the release version of caret but will be in the next release.

Max

$\endgroup$
  • $\begingroup$ Hi Max, Thanks. I came across the timeSlice method (took a bit of searching initially) and was interested in any specific examples of how it is used. I'll go through the help details, but it'd be great if you have any additional information on the same. Thanks, Raj. $\endgroup$ – xbsd Sep 30 '13 at 19:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.