def save_results(predictions, filename):
 with open(filename, 'w') as f:
  f.write('id,ACTION\n')
  for (i, pred) in enumerate(predictions):
   f.write(('%d,%f\n' % ((i + 1), pred)))

def save_results ( predictions , filename ) : with open ( filename , 'w' ) as f : f . write ( 'id,ACTION\n' ) for ( i , pred ) in enumerate ( predictions ) : f . write ( ( '%d,%f\n' % ( ( i + 1 ) , pred ) ) )
given a vector of predictions .