Learn R Programming

inferCSN (version 1.2.0)

calculate_metrics: Calculate Network Prediction Performance Metrics

Description

Calculates comprehensive performance metrics for evaluating predicted network structures, including classification performance, precision-recall metrics, and network topology metrics.

Usage

calculate_metrics(
  network_table,
  ground_truth,
  metric_type = c("all", "auc", "auroc", "auprc", "precision", "recall", "f1",
    "accuracy", "si", "ji"),
  return_plot = FALSE,
  line_color = "#1563cc",
  line_width = 1
)

Value

A list containing:

  • metrics A data frame with requested metrics.

  • plot A plot object if return_plot = TRUE (optional).

Arguments

network_table

A data frame.

ground_truth

A data frame of ground truth network with the same format as network_table.

metric_type

The type of metric to return. Default is "all". This can take any of the following choices:

  • all Returns all available metrics with Performance Metrics plot.

  • auc Returns both AUROC and AUPRC with their plots.

  • auroc Area Under ROC Curve with plot.

  • auprc Area Under Precision-Recall Curve with plot.

  • precision Proportion of correct predictions among positive predictions.

  • recall Proportion of actual positives correctly identified.

  • f1 Harmonic mean of precision and recall.

  • accuracy Overall classification accuracy.

  • si Set Intersection, counting correctly predicted edges.

  • ji Jaccard Index, measuring overlap between predicted and true networks.

return_plot

Whether to generate visualization plots. Default is FALSE.

line_color

Color for plot lines. Default is #1563cc.

line_width

Width for plot lines. Default is 1.

Examples

Run this code
data(example_matrix)
data("example_ground_truth")
network_table <- inferCSN(example_matrix)
calculate_metrics(
  network_table,
  example_ground_truth,
  return_plot = TRUE
)
calculate_metrics(
  network_table,
  example_ground_truth,
  metric_type = "auroc"
)

Run the code above in your browser using DataLab