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

Uploaded Python 3

File details

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

File metadata

  • Download URL: gar_vis-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 0d7f4e7ed02a690233654f278e7c460419dce3fa6ab45bcbe2766d35ab000765
MD5 8075ab63d89c20b002afb74e21138dbc
BLAKE2b-256 2e03037eb59389b649df184d8c0150114efe86c735c090f29b9408d0bac1c072

See more details on using hashes here.

File details

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

File metadata

  • Download URL: gar_vis-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 8.1 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3f5bf2a6f5353c0e5bc8588b44372b7f97db97e46ee28788c595d524c19c184f
MD5 7c2c53bac27fcd0af093ddb119587915
BLAKE2b-256 bc55e5ff6b327c3c2612b9e175c396dea2cc9b27008da1d6f1a9942ed9c2297a

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