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.0.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.0-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: gar_vis-0.1.0.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.0.tar.gz
Algorithm Hash digest
SHA256 c5be4ee1f3bc06181930d06365c71c2dd5f4fd0cad0a6787f65977a92cf70e08
MD5 8476b02ed3b2f891392fc7f7127fbb2e
BLAKE2b-256 991a7f50d57689efbed80b2fe1fffed9147f6735a870791a3f6bb88741c077d3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: gar_vis-0.1.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1ea8a2d951b9e664db1e42b2b671e1d13cfe1a0e13e803e49b6a99fd05354dbf
MD5 19c76474f1ce5e0a5c7b2436c24c9564
BLAKE2b-256 35bd38e06c24989e5666282c02733856431b12cd08712c8b932bd0fed00dddcc

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