def precision(y, y_pred):
    """Precision score

    precision = true_positives / (true_positives + false_positives)
    
    Parameters:
    -----------
    y : vector, shape (n_samples,)
    The target labels.

    y_pred : vector, shape (n_samples,)
    The predicted labels.
    
    Returns:
    --------
    precision : float
    
    """

    tp = true_positives(y, y_pred)
    fp = false_positives(y, y_pred)
    return  tp / (tp + fp)
Precision score

    precision = true_positives / (true_positives + false_positives)
    
    Parameters:
    -----------
    y : vector, shape (n_samples,)
    The target labels.

    y_pred : vector, shape (n_samples,)
    The predicted labels.
    
    Returns:
    --------
    precision : float