def whole_sequence_accuracy(y_true, y_pred, lengths):
    lengths = np.asarray(lengths)
    end = np.cumsum(lengths)
    start = end - lengths
    bounds = np.vstack([start, end]).T

    errors = sum(1. for i, j in bounds
                 if np.any(y_true[i:j] != y_pred[i:j]))
    return 1 - errors / len(lengths)
Average accuracy measured on whole sequences.
dataset/ETHPy150Open larsmans/seqlearn/seqlearn/evaluation.py/whole_sequence_accuracy