Skip to contents

Computes a selection of supervised graph evaluation metrics using ground truth class labels. The metrics are reported (as average) per node/element.

Usage

getGraphElementMetrics(x, labels, directed = NULL, ...)

# S4 method for class 'list'
getGraphElementMetrics(x, labels, metrics, directed = NULL, k = NULL, ...)

# S4 method for class 'data.frame'
getGraphElementMetrics(
  x,
  labels,
  metrics,
  directed = NULL,
  k,
  shared = FALSE,
  ...
)

# S4 method for class 'matrix'
getGraphElementMetrics(
  x,
  labels,
  metrics,
  directed = NULL,
  k,
  shared = FALSE,
  ...
)

# S4 method for class 'igraph'
getGraphElementMetrics(x, labels, directed = NULL, ...)

# S4 method for class 'dist'
getGraphElementMetrics(x, labels, directed = NULL, ...)

Arguments

x

Either an igraph object, a list of nearest neighbors (see details below), or a data.frame or matrix (with features as columns and items as rows) from which nearest neighbors will be computed.

labels

Either a factor or a character vector indicating the true class label of each element (i.e. row or vertex) of x.

directed

Logical; whether to compute the metrics in a directed fashion. If left to NULL, conventional choices will be made per metric (adhesion, cohesion, PWC AMSP undirected, others directed).

...

Optional arguments for emb2knn() or emb2snn().

metrics

The metrics to compute. See details.

k

The number of nearest neighbors to compute and/or use. Can be omitted if x is a graph or list of nearest neighbors.

shared

Logical; whether to use a shared nearest neighbor network instead of a nearest neighbor network. Ignored if x is not an embedding or dist object.

Value

A data.frame of metrics for each node/element of x.