liberata_metrics.metrics.legacy_metric module
This code implements legacy metrics such as the h-index, i-10 index, and g-index.
- liberata_metrics.metrics.legacy_metric.get_author_citations(capital: spmatrix, references: spmatrix, contributor_col: int) Dict[int, int][source]
For a contributor, returns authored manuscripts and corresponding citations
- Parameters:
capital – Sparse matrix of shape (M, M + 3*C). Used to find which manuscripts this author contributed to.
references – Sparse citation matrix of shape (M, M).
contributor_col – Column index of the author in the contributor space (0-indexed, before the M offset). Pass contributor_index_map[id] at the call site.
- Returns:
Dict mapping each manuscript index to its citation count.
- liberata_metrics.metrics.legacy_metric.get_citation_counts(references: spmatrix, manuscript_rows: list[int]) Dict[int, int][source]
Returns the number of incoming citations for each manuscript in the subset.
references[i, j] encodes a citation from paper j (citing) to paper i (cited), so the number of papers citing manuscript i is the number of non-zero entries in row i.
- Parameters:
references – Sparse citation matrix of shape (M, M).
manuscript_row – List of row indices.
- Returns:
Dict mapping each manuscript index to its incoming citation count (int).
- liberata_metrics.metrics.legacy_metric.get_g_index(capital: spmatrix, references: spmatrix, contributor_col: int) int[source]
Computes the g-index
- Parameters:
capital – Sparse matrix of shape (M, M + 3*C). Used to find which manuscripts this author contributed to (author block: cols M to M+C).
references – Sparse citation matrix of shape (M, M).
contributor_col – Column index of the author in the contributor space (0-indexed, before the M offset). Pass contributor_index_map[id] at the call site.
- Returns:
The g-index as an integer
- liberata_metrics.metrics.legacy_metric.get_h_index(capital: spmatrix, references: spmatrix, contributor_col: int) int[source]
Computes the h-index for a single author.
h is the largest integer such that h of the author’s papers each have at least h incoming citations.
- Parameters:
capital – Sparse matrix of shape (M, M + 3*C). Used to find which manuscripts this author contributed to (author block: cols M to M+C).
references – Sparse citation matrix of shape (M, M).
contributor_col – Column index of the author in the contributor space (0-indexed, before the M offset). Pass contributor_index_map[id] at the call site.
- Returns:
The h-index as an integer.
- liberata_metrics.metrics.legacy_metric.get_i10_index(capital: spmatrix, references: spmatrix, contributor_col: int) int[source]
Computes the i-10 index
- Parameters:
capital – Sparse matrix of shape (M, M + 3*C). Used to find which manuscripts this author contributed to. The author block are the cols M to M+C because the capital matrix columns are blocked by author, peer reviewer, and replicator, with each contributor located in indentical indices within each block.
references – Sparse citation matrix of shape (M, M).
contributor_col – Column index of the author in the contributor space (0-indexed, before the M offset). Pass contributor_index_map[id] at the call site.
- Returns:
The i-10 index as an integer