#NEWLINE# def propagate( self , X ) : #NEWLINE# #INDENT# '\n        Uses the model to predict weighted output values\n        Arguments:\n          X is a d-dimenstional numpy array\n        Returns:\n          a c-dimensional numpy array of the strength of each output\n        ' #NEWLINE# layers = self . layers #NEWLINE# length = len ( layers ) #NEWLINE# theta_mat = np . empty ( ( length - 1 ) , dtype = object ) #NEWLINE# flag = 0 #NEWLINE# for i in range ( 0 , ( length - 1 ) ) : #NEWLINE# #INDENT# size = ( layers [ ( i + 1 ) ] * ( layers [ i ] + 1 ) ) #NEWLINE# theta_mat [ i ] = self . theta [ flag : ( flag + size ) ] . reshape ( layers [ ( i + 1 ) ] , ( - 1 ) ) #NEWLINE# flag = ( flag + size ) #NEWLINE# #UNINDENT# layerX = np . empty ( length , dtype = object ) #NEWLINE# layerX [ 0 ] = X #NEWLINE# layerX [ 0 ] = np . append ( 1 , layerX [ 0 ] ) . reshape ( ( - 1 ) , 1 ) #NEWLINE# for j in range ( 1 , length ) : #NEWLINE# #INDENT# layerX [ j ] = self . sigmoid ( np . dot ( theta_mat [ ( j - 1 ) ] , layerX [ ( j - 1 ) ] ) ) #NEWLINE# if ( j < ( length - 1 ) ) : #NEWLINE# #INDENT# layerX [ j ] = np . append ( 1 , layerX [ j ] ) . reshape ( ( - 1 ) , 1 ) #NEWLINE# #UNINDENT# #UNINDENT# self . activation = layerX #NEWLINE# output = layerX [ ( length - 1 ) ] #NEWLINE# return output