<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Preprocessing train dataset
Divide the train folder into two folders mytrain_ox and myvalid_ox
Step1:  Visualize the size of the original train dataset.
Step2:  Shuffle and split the train filenames
Step3:  Visualize the size of the processed train dataset
Step4:  Create symbolic link of images
<ASSISTANT_TASK:>
Python Code:
from sklearn.model_selection import train_test_split
import seaborn as sns
import os
import shutil
import pandas as pd
%matplotlib inline
df = pd.read_csv('list.txt', sep=' ')
df.ix[2000:2005]
Explanation: Preprocessing train dataset
Divide the train folder into two folders mytrain_ox and myvalid_ox
End of explanation
train_cat = df[df['SPECIES'] == 1]
train_dog = df[df['SPECIES'] == 2]
x = ['cat', 'dog']
y = [len(train_cat), len(train_dog)]
ax = sns.barplot(x=x, y=y)
Explanation: Visualize the size of the original train dataset.
End of explanation
mytrain, myvalid = train_test_split(df, test_size=0.1)
print len(mytrain), len(myvalid)
Explanation: Shuffle and split the train filenames
End of explanation
mytrain_cat = mytrain[mytrain['SPECIES'] == 1]
mytrain_dog = mytrain[mytrain['SPECIES'] == 2]
myvalid_cat = myvalid[myvalid['SPECIES'] == 1]
myvalid_dog = myvalid[myvalid['SPECIES'] == 2]
x = ['mytrain_cat', 'mytrain_dog', 'myvalid_cat', 'myvalid_dog']
y = [len(mytrain_cat), len(mytrain_dog), len(myvalid_cat), len(myvalid_dog)]
ax = sns.barplot(x=x, y=y)
Explanation: Visualize the size of the processed train dataset
End of explanation
def remove_and_create_class(dirname):
    if os.path.exists(dirname):
        shutil.rmtree(dirname)
    os.mkdir(dirname)
    os.mkdir(dirname+'/cat')
    os.mkdir(dirname+'/dog')
remove_and_create_class('mytrain_ox')
remove_and_create_class('myvalid_ox')
for filename in mytrain_cat['IMAGE']:
    os.symlink('../../images/'+filename+'.jpg', 'mytrain_ox/cat/'+filename+'.jpg')
for filename in mytrain_dog['IMAGE']:
    os.symlink('../../images/'+filename+'.jpg', 'mytrain_ox/dog/'+filename+'.jpg')
for filename in myvalid_cat['IMAGE']:
    os.symlink('../../images/'+filename+'.jpg', 'myvalid_ox/cat/'+filename+'.jpg')
for filename in myvalid_dog['IMAGE']:
    os.symlink('../../images/'+filename+'.jpg', 'myvalid_ox/dog/'+filename+'.jpg')
Explanation: Create symbolic link of images
End of explanation
<END_TASK>