import torch


def Precision(pred: torch.Tensor, y: torch.Tensor):
    """Precision calculation

    Args:
        pred (torch.Tensor): output label of model
        y (torch.Tensor): actual label 
    """

    # precision = TP / (TP + FP)

    index_ = pred == 1
    TP = (y[index_] == 1).sum()

    return (TP / index_.sum()).item()