#NEWLINE# def stratified_split( self , vals ) : #NEWLINE# #INDENT# ( pos , neg ) = self . pos_neg_vals ( vals ) #NEWLINE# random . shuffle ( pos ) #NEWLINE# train = pos [ : self . num_train ( pos ) ] #NEWLINE# if ( not self . discard_zeros ) : #NEWLINE# #INDENT# random . shuffle ( neg ) #NEWLINE# train . extend ( neg [ : self . num_train ( neg ) ] ) #NEWLINE# random . shuffle ( train ) #NEWLINE# #UNINDENT# test = pos [ self . num_train ( vals ) : ] #NEWLINE# return ( train , test )