#NEWLINE# def destroy( self , timeseries , **args ) : #NEWLINE# #INDENT# percentage = args [ 'percentage' ] #NEWLINE# lseries = timeseries . shape [ 0 ] #NEWLINE# remove_indices = [ ] #NEWLINE# amount_remove = int ( floor ( ( lseries * percentage ) ) ) #NEWLINE# new_amount = ( lseries - amount_remove ) #NEWLINE# newmat = zeros ( ( new_amount , ) , dtype = [ ( 'date' , int32 ) , ( 'corrected_score' , float32 ) , ( 'speed' , float32 ) ] ) #NEWLINE# exceptions = [ 0 , ( lseries - 1 ) ] #NEWLINE# if ( 'exclude' in args . keys ( ) ) : #NEWLINE# #INDENT# exceptions = ( exceptions + args [ 'exclude' ] ) #NEWLINE# #UNINDENT# indices = range ( 0 , timeseries . shape [ 0 ] ) #NEWLINE# for exception in exceptions : #NEWLINE# #INDENT# indices . remove ( exception ) #NEWLINE# #UNINDENT# for i in xrange ( amount_remove ) : #NEWLINE# #INDENT# x = randint ( 0 , ( len ( indices ) - 1 ) ) #NEWLINE# remove_indices . append ( indices [ x ] ) #NEWLINE# indices . remove ( indices [ x ] ) #NEWLINE# #UNINDENT# current = 0 #NEWLINE# for i in xrange ( lseries ) : #NEWLINE# #INDENT# if ( i not in remove_indices ) : #NEWLINE# #INDENT# newmat [ current ] = timeseries [ i ] #NEWLINE# current += 1 #NEWLINE# #UNINDENT# #UNINDENT# return ( newmat , remove_indices )