Skip to main content

cluestar

Gain a clue by clustering!

This library contains visualisation tools that might help you get started with classification tasks. The idea is that if you can inspect clusters easily, you might gain a clue on what good labels for your dataset might be!

It generates charts that looks like this:

Normal plot

There's even a fancy chart that can compare embedding techniques.

Comparing two embeddings

Install

python -m pip install cluestar

Interactive Demo

You can see an interactive demo of the generated widgets here.

You can also toy around with the demo notebook found here.

Usage

The first step is to encode textdata in two dimensions, like below.

from sklearn.pipeline import make_pipeline
from sklearn.decomposition import TruncatedSVD
from sklearn.feature_extraction.text import TfidfVectorizer

pipe = make_pipeline(TfidfVectorizer(), TruncatedSVD(n_components=2))

X = pipe.fit_transform(texts)

From here you can make an interactive chart via;

from cluestar import plot_text

plot_text(X, texts)

The best results are likely found when you use umap together with something like universal sentence encoder.

You might also improve the understandability by highlighting points that have a certain word in it.

plot_text(X, texts, color_words=["plastic", "voucher", "deliver"])

You can also use a numeric array, one that contains proba-values for prediction, to influence the color.

# First, get an array of pvals from some model
p_vals = some_model.predict(texts)[:, 0]
# Use these to assign pretty colors.
plot_text(X, texts, color_array=p_vals)

You can also compare two embeddings interactively. To do this:

from cluestar import plot_text_comparison

plot_text(X1=X, X2=X, texts)

Metadata

Release files for cluestar 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cluestar 0.2.1
File Size Uploaded
cluestar-0.2.1.tar.gz 4.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cluestar 0.2.1
File Interpreter ABI Platform
cluestar-0.2.1-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 10.1 kB

Release files / cluestar-0.2.1.tar.gz

Download URL cluestar-0.2.1.tar.gz
Size 4.8 kB
Tags Source
SHA-256 checksum
How to use checksums
d3b816d8a2b60c60a08737a9225129aaae6757983273cd8e9fb8645105d5c61e
BLAKE2b-256 checksum
How to use checksums
1acbc36629da325ed5773c48f4f1e34f2ecfe2db2e2b2d0cfa304b4a613604d7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.6

Release files / cluestar-0.2.1-py2.py3-none-any.whl

Download URL cluestar-0.2.1-py2.py3-none-any.whl
Size 5.2 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
fcf2cd43c3385130cbc71509947f545d9edbdef6a1811e4dbb007e888bcf7fae
BLAKE2b-256 checksum
How to use checksums
7d1d8cfcec80f1dbe1221dbaa61026b1b9991bb87125ca187f24e04a4f47ec65
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.6

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

0.2.0

2 release files

0.1.0

3 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page