7.6.4. mclearn.preprocessing.draw_random_sample

mclearn.preprocessing.draw_random_sample(data, train_size, test_size, random_state=None)[source]

Split the data into a train set and test set of a given size.

Parameters:
  • data (DataFrame, shape = [n_samples, n_features]) – Where each row is a sample point and each column is a feature.
  • train_size (int) – Number of sample points in the training set.
  • test_size (int) – Number of sample points in the test set.
  • random_state (int, optional (default=None)) – Random seed.
Returns:

combined_train_test – Where each sample point (row) is indexed with either ‘train’ or ‘test’.

Return type:

DataFrame