conn2res.performance.precision_score

conn2res.performance.precision_score(y_true, y_pred, sample_weight=None, average='weighted', **kwargs)[source]

Precision score.

Parameters:
  • y_true (numpy.ndarray) – Ground truth target values.

  • y_pred (numpy.ndarray) – Predicted target values.

  • sample_weight (numpy.ndarray) – Sample weights.

  • average (str) –

    This parameter is required for multiclass targets. If None, the scores for each class are returned. Otherwise, this determines the type of averaging performed on the data:

    ’micro’: Calculate metrics globally by counting the total true positives, false negatives and false positives.

    ’macro’: Calculate metrics for each label, and find their unweighted mean. This does not take label imbalance into account.

    ’weighted’: Calculate metrics for each label, and find their average weighted by support (the number of true instances for each label). This alters ‘macro’ to account for label imbalance; it can result in an F-score that is not between precision and recall.

Returns:

score – A floating point value.

Return type:

float.