eval.py
def meanF1array(y, pred):
  """
  Function for computing mean F1-score given ground truth labels
  and a same-sized numpy array of 0-1 predictions.
  
  Params:
    y - 0-1 array of ground truth labels
        a numpy array of size (# instances) x (# classes)
    pred - 0-1 array of predictions of same size as y
    
  Returns:
    mean F1-score for the predictions, pred given the labels, y
  """
  row_f1 = np.zeros((y.shape[0]))
  for k in range(y.shape[0]):
    tp = (pred[k] * y[k]).sum()
    fp = (pred[k] > y[k]).sum()
    fn = (pred[k] < y[k]).sum()
    precision = tp/(tp + fp + 1e-9)
    recall = tp/(tp + fn + 1e-9)
    row_f1[k] = 2 * precision * recall / (precision + recall + 1e-9)
  return np.mean(row_f1)

  Function for computing mean F1-score given ground truth labels
  and a same-sized numpy array of 0-1 predictions.
  
  Params:
    y - 0-1 array of ground truth labels
        a numpy array of size (# instances) x (# classes)
    pred - 0-1 array of predictions of same size as y
    
  Returns:
    mean F1-score for the predictions, pred given the labels, y
  
Function for computing mean F1-score given ground truth labels
and a same-sized numpy array of 0-1 predictions.

0-1 array of ground truth labels
a numpy array of size (# instances) x (# classes)
pred - 0-1 array of predictions of same size as y

mean F1-score for the predictions, pred given the labels, y
Function for computing mean F1 - score given ground truth labels and a same - sized numpy array of 0 - 1 predictions . 0 - 1 array of ground truth labels a numpy array of size ( # instances ) x ( # classes ) pred - 0 - 1 array of predictions of same size as y mean F1 - score for the predictions pred given the labels y
def meanF1array(y, pred):
  row_f1 = np.zeros((y.shape[0]))
  for k in range(y.shape[0]):
    tp = (pred[k] * y[k]).sum()
    fp = (pred[k] > y[k]).sum()
    fn = (pred[k] < y[k]).sum()
    precision = tp/(tp + fp + 1e-9)
    recall = tp/(tp + fn + 1e-9)
    row_f1[k] = 2 * precision * recall / (precision + recall + 1e-9)
  return np.mean(row_f1)
def meanF1array ( y , pred ) : row_f1 = np . zeros ( ( y . shape [ 0 ] ) ) for k in range ( y . shape [ 0 ] ) : tp = ( pred [ k ] * y [ k ] ) . sum ( ) fp = ( pred [ k ] > y [ k ] ) . sum ( ) fn = ( pred [ k ] < y [ k ] ) . sum ( ) precision = tp / ( tp + fp + 1e-9 ) recall = tp / ( tp + fn + 1e-9 ) row_f1 [ k ] = 2 * precision * recall / ( precision + recall + 1e-9 ) return np . mean ( row_f1 )
Function for computing mean F1-score given ground truth labels
and a same-sized numpy array of 0-1 predictions.
Function for computing mean F1 - score given ground truth labels and a same - sized numpy array of 0 - 1 predictions .
"""
  Function for computing mean F1-score given ground truth labels
  and a same-sized numpy array of 0-1 predictions.
  
  Params:
    y - 0-1 array of ground truth labels
        a numpy array of size (# instances) x (# classes)
    pred - 0-1 array of predictions of same size as y
    
  Returns:
    mean F1-score for the predictions, pred given the labels, y
  """
y
pred