Skip to main content

Tools that use LLM to explain datasets

Project description

Scalable Understanding of Datasets and Models with the Help of Large Language Models

I will make a video tutorial on this topic; stay tuned. This is the library and notebooks to help the audience understand my tutorial.

Installation

I recommend creating a conda environment with python >= 3.9 to use this package.

  1. Set up your openai key in your environment. i.e. export OPENAI_API_KEY="[Your OPENAI API KEY]"
  2. Installation

Option 1: clone and install locally (for developers)

  • git clone git@github.com:ruiqi-zhong/llm_explain.git
  • cd llm_explain
  • pip install -e .

Option 2: install from github repo

pip3 install --no-cache-dir -v git+https://github.com/ruiqi-zhong/llm_explain.git

Option 3: install from pypi

pip3 install llm-explain

Usage

This repo supports the bare bone implementation for explaining dataset differences and clusters.

See the notebooks, llm_explain/tests/test_cluster.py, and llm_explain/tests/test_diff.py to understand how to use the functions implemented in this repo.

If you want to build on it, refer to other test files to understand the rest of the repo.

A quick example after installation

run python:

>>> from llm_explain.models.diff import explain_diff                                                                                                                           
>>> explain_diff(["cat", "dog", "fish", "carrot", "potato", "apple"], [False, False, False, True, True, True], proposer_num_rounds=2, proposer_num_explanations_per_round=2)

You will get outputs similar to the following in fewer than 30 seconds:

Printing top 3 explanations:
Explanation: refers to a plant-based item; specifically, the text mentions items that grow from plants, including vegetables and fruits. For example, 'carrot' is a type of root vegetable.
Accuracy: 1.0

Explanation: is a type of food; specifically, the text refers to items commonly recognized as food, typically vegetables or fruits. For example, 'apple' is known to be a fruit consumed as food.
Accuracy: 0.8333333333333333

Explanation: mentions a type of food; specifically, the text refers to something that is commonly eaten by humans. For example, 'This apple is very juicy.'
Accuracy: 0.8333333333333333

Notebooks

The notebooks illustrate the following sections in the video tutorial.

  • 1.1 Core method: the proposer-validator framework
  • 1.1 Extension 1: precise explanations.
  • 1.1 Extension 2: goal-constrained explanations.
  • 1.1 Extension 3: multiple explanations
  • 1.2: Explainable clustering

Related works

related/references.pdf contains the related works mentioned in our presentation. related/main.tex contains the latex source file and references.bib contains the bibtex citations.

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

llm_explain-0.1.1.tar.gz (16.0 kB view details)

Uploaded Source

Built Distribution

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

llm_explain-0.1.1-py3-none-any.whl (18.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: llm_explain-0.1.1.tar.gz
  • Upload date:
  • Size: 16.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.21

File hashes

Hashes for llm_explain-0.1.1.tar.gz
Algorithm Hash digest
SHA256 531b00c410561884d05b20ccac662a2ef31017f1360c3e83f174aa1b14c426de
MD5 cef24941f104fbf3184fb1bd33a5fc5b
BLAKE2b-256 2b544856baf79012df57b1f1e573181bc21d98e677839aca16cee8ea924da0ff

See more details on using hashes here.

File details

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

File metadata

  • Download URL: llm_explain-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 18.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.21

File hashes

Hashes for llm_explain-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 779b003b6103a39ee528563cab6f3215b11219dfd911a8e075de835608f7c332
MD5 a0118049634c7655280fa36e56a3d238
BLAKE2b-256 97bfee498511007aa8207b7555acf6f7fa251b4c585acf770f2815c1edfe8a05

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