Skip to main content

RankFlow

Library for plotting multiple ranks evolved over processing steps - drawing a rankflow.

RankFlow

RankFlow is a Python package that allows you to create rank flow plots, helping visualize the changes in ranking of nodes.

Initially it was applied to re-ranking visualization of nodes (parts of documents, document chunks) during the retrieval and re-ranking processes within a Retrieval Augmented Generation (RAG) retriever but the usage is not limited to RAG.

Installation

pip install rankflow

Usage

    my_step_labels: list[str] = [
        "Hybrid Search",
        "Cross-encoder",
        "Graph-reranker",
        "Booster",
    ]
    my_chunk_labels: list[str] = [
        "Doc 0",
        "Doc 1",
        "Doc 2",
        "Doc 3",
        "Doc 4",
        "Doc 5",
        "Doc 6",
        "Doc 7",
        "Doc 8",
        "Doc 9",
    ]
    my_ranks = np.array(
        [
            [0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
            [3, 0, 2, 4, 1, 6, 7, 9, 5, 8],
            [2, 3, 0, 4, 6, 1, 7, 8, 5, 9],
            [5, 3, 2, 1, 0, 4, 6, 7, 8, 9],
        ]
    )

    rf = RankFlow(
        ranks=my_ranks,
        step_labels=my_step_labels,
        chunk_labels=my_chunk_labels,
        fig_size=(6, 6),
        title_font_size=24,
    )
    _ = rf.plot()

    # save the plot to png
    plt.savefig("rankflow.png")
    
    plt.show()

This should produce the following plot:

RankFlow

License

MIT © Krystian Safjan.

Download files

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

Source Distribution

rankflow-0.1.1.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

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

rankflow-0.1.1-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: rankflow-0.1.1.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.15.4 CPython/3.12.4 Darwin/23.5.0

File hashes

Hashes for rankflow-0.1.1.tar.gz
Algorithm Hash digest
SHA256 c6bc4d0ed7028ddae9d74ba6a8bcf8b55e70d73343b9f8b8f0f2911fc74ca151
MD5 9fa6ecda2fe03340405c0c85f468db37
BLAKE2b-256 a3396d573385c1493fee030ec35618e5c6b8b4bc95ecaba524de5730663e7358

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rankflow-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 5.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.15.4 CPython/3.12.4 Darwin/23.5.0

File hashes

Hashes for rankflow-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 05f502bf23546819d06d1ac76c221406f8022f59ac3ac4734f64959db1a1916f
MD5 c147e937a5bb0b092eb7534cd4060962
BLAKE2b-256 00b5ad8e667f399e576a060f4036ec73e40b6cde33fb423d971ecc9ed7e36e97

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 Sentry Error logging StatusPage Status page