def split_train_test(all_instances, n=None):
 random.seed(12345)
 random.shuffle(all_instances)
 if ((not n) or (n > len(all_instances))):
  n = len(all_instances)
 train_set = all_instances[:int((0.8 * n))]
 test_set = all_instances[int((0.8 * n)):n]
 return (train_set, test_set)

def split_train_test ( all_instances , n = None ) : random . seed ( 12345 ) random . shuffle ( all_instances ) if ( ( not n ) or ( n > len ( all_instances ) ) ) : n = len ( all_instances ) train_set = all_instances [ : int ( ( 0.8 * n ) ) ] test_set = all_instances [ int ( ( 0.8 * n ) ) : n ] return ( train_set , test_set )
randomly split n instances of the dataset into train and test sets .