pyTigerGraph GDS Metrics

Utility for gathering metrics for GNN predictions.

Accuracy

Accuracy = sum(predictions == labels) / len(labels)

Usage:

  • Call the update function to add predictions and labels.

  • Get accuracy score at any point by accessing the value property.

update()

update(preds: ndarray, labels: ndarray) → None

Add predictions and labels to be compared.

Parameters:

  • preds (ndarray): Array of predicted labels.

  • labels (ndarray): Array of true labels.

value()

value() → float

Get accuracy score.

Returns:

Accuracy score (float).

BinaryRecall

Recall = \( rac{\sum(predictions * labels)}{\sum(labels)}\)

This metric is for binary classifications, i.e., both predictions and labels are arrays of 0’s and 1’s.

Usage:

  • Call the update function to add predictions and labels.

  • Get recall score at any point by accessing the value property.

update()

update(preds: ndarray, labels: ndarray) → None

Add predictions and labels to be compared.

Parameters:

  • preds (ndarray): Array of predicted labels.

  • labels (ndarray): Array of true labels.

value()

value() → float

Get recall score.

Returns:

Recall score (float).

BinaryPrecision

Precision = \( rac{\sum(predictions * labels)}{\sum(predictions)}\)

This metric is for binary classifications, i.e., both predictions and labels are arrays of 0’s and 1’s.

Usage:

  • Call the update function to add predictions and labels.

  • Get precision score at any point by accessing the value property.

update()

update(preds: ndarray, labels: ndarray) → None

Add predictions and labels to be compared.

Parameters:

  • preds (ndarray): Array of predicted labels.

  • labels (ndarray): Array of true labels.

value()

value() → float

Get precision score.

Returns:

Precision score (float).