Skip to main content

Visualisation tool for Corpus Graphs

Project description

gar_vis

Visualisation tool for Corpus Graphs

Installation

Install the package via pip:

pip install gar-vis

Getting Started

Run the following code for a simple demo:

import pyterrier as pt
from pyterrier_adaptive import CorpusGraph
from pyterrier_pisa import PisaIndex

from gar_vis import GarVis

if __name__ == "__main__":
    corpus_graph = CorpusGraph.from_hf("macavaney/msmarco-passage.corpusgraph.bm25.128")
    bm25 = PisaIndex.from_dataset("msmarco_passage").bm25()
    dataset = pt.get_dataset(f"irds:msmarco-passage/trec-dl-2019/judged")

    file_path = GarVis.create_neighbourhood(corpus_graph, bm25, dataset)
    GarVis.visualise_neighbourhood(file_path, dataset, min_rel=2)

Or use it with a different corpus graph, retriever and/or dataset (including qrels):

import pyterrier as pt
from pyterrier_adaptive import CorpusGraph
from pyterrier_pisa import PisaIndex

from gar_vis import GarVis

if __name__ == "__main__":
    corpus_graph = ...
    retriever = ...
    dataset = ...

    # Create a new neighbourhood
    file_path = GarVis.create_neighbourhood(corpus_graph, bm25, dataset, k=num_neighbours, run_id="file_name", save_dir = "path_to_file")

    # Or use an existing neighbourhood
    file_path = "path_to_file/file_name.h5"

    # And start the visulisation tool (min_rel is used to set the minimum relevance label to consider the document relevant)
    GarVis.visualise_neighbourhood(file_path, dataset, min_rel=2)

Citation

@inproceedings{rear2025,
    title = {Resource Efficient Adaptive Retrieval},
    author = {Martijn Smits},
    year = {2025},
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gar_vis-0.1.2.tar.gz (7.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gar_vis-0.1.2-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file gar_vis-0.1.2.tar.gz.

File metadata

  • Download URL: gar_vis-0.1.2.tar.gz
  • Upload date:
  • Size: 7.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.12

File hashes

Hashes for gar_vis-0.1.2.tar.gz
Algorithm Hash digest
SHA256 fa2de2e7008aff2b195bbd18c59176fea0970c85cab850f6237f986b3b84b734
MD5 9e8b6fa46cbd46a52e89866654883fc8
BLAKE2b-256 42b65689a0a8361f26b6802705366355e44963abe812bca09bf69be26fe24d8c

See more details on using hashes here.

File details

Details for the file gar_vis-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: gar_vis-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 8.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.12

File hashes

Hashes for gar_vis-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e53d574dff6c261dbf8e778bf66164a624f1710671078cdf1e1cc8f54342b153
MD5 8e601fd40ace3b3e1482c037296d69d4
BLAKE2b-256 b3ea5680c9d1a10b311d1721e5fc03246f37612e7b76065b24000d636fc7a936

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page