util.py
def writeSubmission(submit_num, pred):
  """
  Writes out the predictions in the correct form for submission to Kaggle.

  NB: This code is pretty slow (~ 15min).
  
  Params:
    submit_num - the submission is named submission<submit_num>.csv.gz
    pred - a 0-1 numpy array of predictions of dimension 
            (# test instances) x (# classes)

  Returns:
    nothing, but writes submission file into submissions/
  """
  ss = pd.read_csv(SAMPLE)
  for k in range(pred.shape[0]):
    s = np.array_str(pred[k].nonzero()[0] + 1)
    s = s[1:-1].strip()
    s = re.sub(r"\W+", " ", s)
    ss.Labels[k] = s
  path = SUBMISSION_PATH % submit_num
  with gzip.open(path, 'wb') as f:
    ss.to_csv(f, index=False)

  Writes out the predictions in the correct form for submission to Kaggle.

  NB: This code is pretty slow (~ 15min).
  
  Params:
    submit_num - the submission is named submission<submit_num>.csv.gz
    pred - a 0-1 numpy array of predictions of dimension 
            (# test instances) x (# classes)

  Returns:
    nothing, but writes submission file into submissions/
  
Writes out the predictions in the correct form for submission to Kaggle.
NB: This code is pretty slow (~ 15min).

the submission is named submission.csv.gz
pred - a 0-1 numpy array of predictions of dimension
(# test instances) x (# classes)

nothing, but writes submission file into submissions
Writes out the predictions in the correct form for submission to Kaggle . NB : This code is pretty slow ( ~ 15min ) . the submission is named submission . csv . gz pred - a 0 - 1 numpy array of predictions of dimension ( # test instances ) x ( # classes ) nothing but writes submission file into submissions
def writeSubmission(submit_num, pred):
  ss = pd.read_csv(SAMPLE)
  for k in range(pred.shape[0]):
    s = np.array_str(pred[k].nonzero()[0] + 1)
    s = s[1:-1].strip()
    s = re.sub(r"\W+", " ", s)
    ss.Labels[k] = s
  path = SUBMISSION_PATH % submit_num
  with gzip.open(path, 'wb') as f:
    ss.to_csv(f, index=False)
def writeSubmission ( submit_num , pred ) : ss = pd . read_csv ( SAMPLE ) for k in range ( pred . shape [ 0 ] ) : s = np . array_str ( pred [ k ] . nonzero ( ) [ 0 ] + 1 ) s = s [ 1 : - 1 ] . strip ( ) s = re . sub ( r"\W+" , " " , s ) ss . Labels [ k ] = s path = SUBMISSION_PATH % submit_num with gzip . open ( path , 'wb' ) as f : ss . to_csv ( f , index = False )
Writes out the predictions in the correct form for submission to Kaggle.
Writes out the predictions in the correct form for submission to Kaggle .
"""
  Writes out the predictions in the correct form for submission to Kaggle.

  NB: This code is pretty slow (~ 15min).
  
  Params:
    submit_num - the submission is named submission<submit_num>.csv.gz
    pred - a 0-1 numpy array of predictions of dimension 
            (# test instances) x (# classes)

  Returns:
    nothing, but writes submission file into submissions/
  """
submit_num
pred