#NEWLINE# def map_fit( interface , state , label , inp ) : #NEWLINE# #INDENT# import numpy as np #NEWLINE# ( a , b ) = ( 0 , 0 ) #NEWLINE# out = interface . output ( 0 ) #NEWLINE# for row in inp : #NEWLINE# #INDENT# row = row . strip ( ) . split ( state [ 'delimiter' ] ) #NEWLINE# if ( len ( row ) > 1 ) : #NEWLINE# #INDENT# x = np . array ( ( [ 1 ] + [ ( 0 if ( v in state [ 'missing_vals' ] ) else float ( v ) ) for ( i , v ) in enumerate ( row ) if ( i in state [ 'X_indices' ] ) ] ) ) #NEWLINE# y = float ( row [ state [ 'y_index' ] ] ) #NEWLINE# a += np . outer ( x , out ) #NEWLINE# b += ( x * y ) #NEWLINE# #UNINDENT# #UNINDENT# out . add ( 'b' , b ) #NEWLINE# for ( i , row ) in enumerate ( a ) : #NEWLINE# #INDENT# out . add ( i , row )