battelle.nn.NeuralNetwork.get_metrics

NeuralNetwork.get_metrics(features, labels, binary_function)

Compute metrics for a binary classification using data from features and labels. Returns a dictionary containing the keys “precision”, “recall”, “f1_score” and “accuracy”.

Parameters
  • x (np.array) – A list of features

  • y (np.array) – The corresponding list of labels.

  • binary_function ((np.array) -> {0,1}) – A function which classifies the output into two categories. Category 1 is positive, while the category 0 is negative.

Returns

A dictionary containing the calculated metrics.

Return type

dict