import torch


def compute_binary_accuracy(
        prediction: torch.Tensor,
        gold: torch.Tensor,
) -> float:
    """
    Get the accuracy from a set of predictions and gold labels
    :param prediction: (N,) Torch variable where each element is probability of True / 1 label
    :param gold: (N,) Same shape as prediction
    :return:
    """
    correct = torch.eq(torch.gt(prediction, 0.5).float(), gold).float().sum().data.cpu().numpy()
    return float(correct) / gold.size()[0]