View source: R/pagerank_grid.R
| pagerank_grid | R Documentation |
Executes [pagerank()] for each entry in a named parameter grid, returning a single combined data frame with a 'model_id' column identifying which configuration produced each row.
pagerank_grid(
edge_list_df,
params_grid,
redirects_df = NULL,
...,
edge_from_col = "from",
edge_to_col = "to"
)
edge_list_df |
A data frame representing the edge list (passed to every [pagerank()] call). |
params_grid |
A named list of named lists. Each inner list contains parameter overrides for [pagerank()]. The top-level names become the 'model_id' values in the output. |
redirects_df |
An optional redirect data frame (passed to every call). Default 'NULL'. |
... |
Common parameters shared across all models (e.g., 'clean_edge_urls', 'rurl_params', 'damping'). These are passed to every [pagerank()] call and can be overridden by entries in 'params_grid'. |
edge_from_col, edge_to_col |
Names of from/to columns in 'edge_list_df'. Default '"from"' / '"to"'. |
A data frame with columns 'model_id', 'node_name', and 'pagerank' (or the column names returned by [pagerank()]). Rows from different models are stacked via [rbind()].
edges <- data.frame(
from = c("A", "B", "C", "A"),
to = c("B", "C", "A", "C")
)
params <- list(
baseline = list(damping = 0.85, self_loops = "drop"),
high_damp = list(damping = 0.95, self_loops = "drop"),
keep_loops = list(damping = 0.85, self_loops = "keep")
)
grid <- pagerank_grid(edges, params, clean_edge_urls = FALSE)
print(grid)
# Compare two models from the grid
baseline <- grid[grid$model_id == "baseline", ]
high_damp <- grid[grid$model_id == "high_damp", ]
compare_pagerank(baseline, high_damp)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.