#NEWLINE# def splitWithProportion( self , proportion = 0.5 ) : #NEWLINE# #INDENT# 'Produce two new datasets, the first one containing the fraction given\n        by `proportion` of the samples.' #NEWLINE# indicies = random . permutation ( len ( self ) ) #NEWLINE# separator = int ( ( len ( self ) * proportion ) ) #NEWLINE# leftIndicies = indicies [ : separator ] #NEWLINE# rightIndicies = indicies [ separator : ] #NEWLINE# leftDs = SupervisedDataSet ( inp = self [ 'input' ] [ leftIndicies ] . copy ( ) , target = self [ 'target' ] [ leftIndicies ] . copy ( ) ) #NEWLINE# rightDs = SupervisedDataSet ( inp = self [ 'input' ] [ rightIndicies ] . copy ( ) , target = self [ 'target' ] [ rightIndicies ] . copy ( ) ) #NEWLINE# return ( leftDs , rightDs )