#NEWLINE# def check_array_lengths( X , Y , W ) : #NEWLINE# #INDENT# x_lengths = [ x . shape [ 0 ] for x in X ] #NEWLINE# y_lengths = [ y . shape [ 0 ] for y in Y ] #NEWLINE# w_lengths = [ w . shape [ 0 ] for w in W ] #NEWLINE# set_x = set ( x_lengths ) #NEWLINE# if ( len ( set_x ) != 1 ) : #NEWLINE# #INDENT# raise Exception ( 'All input arrays (x) should have the same number of samples.' ) #NEWLINE# #UNINDENT# set_y = set ( y_lengths ) #NEWLINE# if ( len ( set_y ) != 1 ) : #NEWLINE# #INDENT# raise Exception ( 'All target arrays (y) should have the same number of samples.' ) #NEWLINE# #UNINDENT# set_w = set ( Y ) #NEWLINE# if ( len ( set_w ) != 1 ) : #NEWLINE# #INDENT# raise Exception ( 'All sample_weight arrays should have the same number of samples.' ) #NEWLINE# #UNINDENT# if ( list ( set_x ) [ 0 ] != list ( set_y ) [ 0 ] ) : #NEWLINE# #INDENT# raise Exception ( ( ( ( ( 'Input arrays should have the same number of samples as target arrays. Found ' + str ( list ( set_x ) [ 0 ] ) ) + ' input samples and ' ) + str ( list ( set_y ) [ 0 ] ) ) + ' target samples.' ) ) #NEWLINE# #UNINDENT# if ( list ( set_x ) [ 0 ] != list ( set_w ) [ 0 ] ) : #NEWLINE# #INDENT# raise Exception ( ( ( ( ( 'Sample_weight arrays should have the same number of samples as input arrays. Found ' + str ( list ( set_x ) [ 0 ] ) ) + ' input samples and ' ) + str ( list ( set_w ) [ 0 ] ) ) + ' target samples.' ) )