Python: Method .as_matrix will be removed in a future version. Use .values instead

It should be:

train_X, test_X, train_y, test_y = train_test_split(X.values, y.values, test_size=0.25)

See this.


According to Panda 0.25.1 documentation, they recommend more using DataFrame.to_numpy() than DataFrame.values()

https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.values.html#pandas.DataFrame.values

So I'd like to suggest to update it like below:

train_X, test_X, train_y, test_y = train_test_split(X.to_numpy(), y.to_numpy(), test_size=0.25)