I have a data set of companies having different feature variables like number of employees, sector, revenue or location. And I also have a target variable (energy consumption) I want to predict by means of supervised learning.
As I have data from several years, some of the companies appear more often in my dataset; e.g. I could have data from Microsoft for the years 2014 - 2017, thus Microsoft appears four times in my dataset. Obviously, examples coming from the same company but from different years are closer correlated than data from different companies.
My question is: How should I split the data into training and test set under these conditions? Is this correlation between some samples a problem, even if I provide the company name as a feature to the model (thus enabling it to learn the individual characteristics of the companies)? Should I restrict my data to examples coming from the same year? Or do I somehow need a different model design which is more like a longitudinal study?
Thanks a lot!