% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/link_prediction.R
\name{evaluate_links}
\alias{evaluate_links}
\title{Evaluate Link Predictions Against Known Edges}
\usage{
evaluate_links(pred, true_edges, k = c(5L, 10L, 20L))
}
\arguments{
\item{pred}{A \code{net_link_prediction} object.}

\item{true_edges}{A data frame with columns \code{from} and \code{to},
or a binary matrix where 1 indicates a true edge.}

\item{k}{Integer vector. Values of k for precision\eqn{@}k.
Default: \code{c(5, 10, 20)}.}
}
\value{
A data frame with columns: method, auc, average_precision,
and one precision_at_k column per k value.
}
\description{
Computes AUC-ROC, precision\eqn{@}k, and average precision for link
predictions against a set of known true edges.
}
\examples{
set.seed(42)
seqs <- data.frame(
  V1 = sample(LETTERS[1:5], 50, TRUE),
  V2 = sample(LETTERS[1:5], 50, TRUE),
  V3 = sample(LETTERS[1:5], 50, TRUE)
)
net <- build_network(seqs, method = "relative")
pred <- predict_links(net, exclude_existing = FALSE)

# Evaluate: predict the network's own edges
true <- data.frame(from = pred$predictions$from[1:5],
                   to = pred$predictions$to[1:5])
evaluate_links(pred, true)

}
