0
$\begingroup$

Let's say I have a feature set X that is of size m x 2, where m are samples, and the two features are timepoint and panel. timepoint is a variable which ranges from 1 to 100, and represents the time at which the sample was taken, and panel is a categorical variable that is a unique identifier for each time series. My outcome variable y is of shape m x 1 and is a continuous variable. I want to train a regression model.

In other words, a small excerpt with timepoints 1-3 might look like:

y    timepoint    panel
1.5  1            1
5.4  2            1
6.7  3            1
3.3  1            2
3.4  2            2
4    3            2

How do I properly split this data into train/test, without resulting in leakage between the two sets?

  1. Train/test split on X, ignoring the grouping variable (i.e. randomly take 33% of the rows in X as my test)?
  2. Split based on the grouping variable (i.e. randomly take 33% of the groups in panel)?

My hunch is that #2 is the proper way to do this. Suggestions?

$\endgroup$
  • $\begingroup$ So panel is a categorical variable? how many groups does it have? $\endgroup$ – horaceT Sep 8 '16 at 16:51
  • $\begingroup$ @horaceT Yes, panel is a categorical variable. It has thousands of levels, as it's a unique identifier for each timeseries. $\endgroup$ – user1566200 Sep 8 '16 at 16:52
2
$\begingroup$

Your hunch is correct, if the "levels" of the panel variable are an independent random sample.

$\endgroup$

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.