(seq1, seq2)
return np.sum(np.equal(seq1s, seq2s)) / max_length
Token-level accuracy.
Token-level accuracy.
Token - level accuracy .
def _accuracy(seq1, seq2):
  """Token-level accuracy."""
  seq1, seq2 = np.array(seq1), np.array(seq2)
  max_length = max(seq1.shape[-1], seq2.shape[-1])
  min_length = min(seq1.shape[-1], seq2.shape[-1])
  seq1s, seq2s = seq1[..., :min_length], seq2[..., :min_length]
  return np.sum(np.equal(seq1s, seq2s)) / max_length
def _accuracy ( seq1 , seq2 ) : seq1 , seq2 = np . array ( seq1 ) , np . array ( seq2 ) max_length = max ( seq1 . shape [ - 1 ] , seq2 . shape [ - 1 ] ) min_length = min ( seq1 . shape [ - 1 ] , seq2 . shape [ - 1 ] ) seq1s , seq2s = seq1 [ ... , : min_length ] , seq2 [ ... , : min_length ] return np . sum ( np . equal ( seq1s , seq2s ) ) / max_length