original_docstring: 
      Write probabilities to an output csv which is compressed with gzip.
      input:  out_fname - name of the output file.
                         Append .csv if you like. Do not append with .gz.
              p - probability matrix.
                  dim-0 specifies the file predicitons are of
                  dim-1 specifies which class the prediciton is for
              names - names of the things which are being classified
              classes - the classes predictions are placed into
      output: None
              writes a gzip compressed csv file to `out_fname`.gz on disk
      
docstring: Write probabilities to an output csv which is compressed with gzip.
  input:  out_fname - name of the output file.
  Append .csv if you like. Do not append with .gz.
  p - probability matrix.
  dim-0 specifies the file predicitons are of
  dim-1 specifies which class the prediciton is for
  names - names of the things which are being classified
  classes - the classes predictions are placed into
  output: None
  writes a gzip compressed csv file to `out_fname`.gz on disk
docstring_tokens: Write probabilities to an output csv which is compressed with gzip . input : out_fname - name of the output file . Append . csv if you like . Do not append with . gz . p - probability matrix . dim - 0 specifies the file predicitons are of dim - 1 specifies which class the prediciton is for names - names of the things which are being classified classes - the classes predictions are placed into output : None writes a gzip compressed csv file to ` out_fname ` . gz on disk
code: def write_predictions(out_fname, p, names, classes):
      """
      Write probabilities to an output csv which is compressed with gzip.
      input:  out_fname - name of the output file.
                         Append .csv if you like. Do not append with .gz.
              p - probability matrix.
                  dim-0 specifies the file predicitons are of
                  dim-1 specifies which class the prediciton is for
              names - names of the things which are being classified
              classes - the classes predictions are placed into
      output: None
              writes a gzip compressed csv file to `out_fname`.gz on disk
      """
      
      if len(names)!=p.shape[0]:
          print "Oh no! looks like the names don't match the predictions!"
  
      # check filename
      if out_fname.split(".")[-1] != "gz":
          out_fname = out_fname + ".gz"
  
      # Write the probabilites as a CSV
      with gzip.open(out_fname, 'wb') as csv_out:
          out_writer = csv.writer(csv_out, delimiter=',')
          out_writer.writerow(['image'] + list(classes))
          for index in range(len(names)):
              out_writer.writerow([names[index]] + list(p[index,]))
code_tokens: def write_predictions ( out_fname , p , names , classes ) : if len ( names ) != p . shape [ 0 ] : print "Oh no! looks like the names don't match the predictions!" if out_fname . split ( "." ) [ - 1 ] != "gz" : out_fname = out_fname + ".gz" with gzip . open ( out_fname , 'wb' ) as csv_out : out_writer = csv . writer ( csv_out , delimiter = ',' ) out_writer . writerow ( [ 'image' ] + list ( classes ) ) for index in range ( len ( names ) ) : out_writer . writerow ( [ names [ index ] ] + list ( p [ index , ] ) )
short_docstring: Write probabilities to an output csv which is compressed with gzip.
short_docstring_tokens: Write probabilities to an output csv which is compressed with gzip .
comment: """
      Write probabilities to an output csv which is compressed with gzip.
      input:  out_fname - name of the output file.
                         Append .csv if you like. Do not append with .gz.
              p - probability matrix.
                  dim-0 specifies the file predicitons are of
                  dim-1 specifies which class the prediciton is for
              names - names of the things which are being classified
              classes - the classes predictions are placed into
      output: None
              writes a gzip compressed csv file to `out_fname`.gz on disk
      """$SEP$# check filename$SEP$# Write the probabilites as a CSV