evalml.preprocessing.split_data(X, y, regression=False, test_size=0.2, random_state=None)[source]

Splits data into train and test sets.

  • X (pd.DataFrame or np.array) – data of shape [n_samples, n_features]

  • y (pd.Series) – labels of length [n_samples]

  • regression (bool) – if true, do not use stratified split

  • test_size (float) – percent of train set to holdout for testing

  • random_state (int, np.random.RandomState) – seed for the random number generator


features and labels each split into train and test sets

Return type

pd.DataFrame, pd.DataFrame, pd.Series, pd.Series