Skip to main content

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

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.0.tar.gz (4.4 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.0-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: rankflow-0.1.0.tar.gz
  • Upload date:
  • Size: 4.4 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.0.tar.gz
Algorithm Hash digest
SHA256 7524f13f162410ba79a4f5c8e2957351ed8fa607947825e69d478d4d21573d69
MD5 d5a1ed0dc806e2ac56796088a6cefb7f
BLAKE2b-256 8ac47a861e5325ad352fadba08514479180c3370f254103470e35cd9ac26bc25

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rankflow-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.9 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 582c5521100b7306b7ec1734a9b06e30c249a2f8991e96597115197a2a728bac
MD5 835c05943d671ac3d8cce6b42bdbfcd9
BLAKE2b-256 f64298a48811bbe4916e4cd7394aeccc5b8aaab8482c4c648f30adac808a6d61

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