[Question]How to split dataset into training, test, validation using scikit?

I have the following dataset in a csv file. p_i_j value of pixel in row i, column j with value 0 or 1. I have the following dataset

I read the csv file using pandas.

 df = pd.read_csv('letter.csv')

When I print df.values i get the following results

[['o' 0 0 ..., 0 0 0]
 ['m' 0 0 ..., 0 0 0]
 ['m' 0 0 ..., 0 0 0]
 ...,
 ['i' 0 0 ..., 1 0 0]
 ['a' 0 0 ..., 0 0 0]
 ['l' 0 1 ..., 1 1 0]]

SciKit Learn has a method for splitting dataset.

sklearn.corss_validation.train_test_split(X,Y, test_size,random_stat)

How do I use SciKit Learn to split my dataset? What will replace X and Y?

Posted Aug 29, 2016, 11:02 PM UTC

12
Loading comments…