title: XGBoost: split data in train and test
body: <p>I am using the python interface for XGBoost for building models. I have a dataset that I am reading in using <code>xgb.DMatrix(data_path)</code>. I need to split this data into train and test (and validation, if required). But most of the implementations I have seen are of the form</p>
  
  <pre><code>dtrain = xgb.DMatrix('')
  dtest = xgb.DMatrix('')
  </code></pre>
  
  <p>I couldn't find a way to where we can read in the dataset and then split 'em into train, test (and validation) sets. </p>
  
  <p>Furthermore, is it possible to perform stratified sampling while splitting into train and test?</p>
  
  <p>I need to know this because I have slightly larger datasets and currently I am reading it in using spark, splitting them up, storing on disk and then reading from there. Is there a way I can do it without having to go through Pyspark and reading from the hdfs?</p>