A command-line tool for generating UMAP plots and KMeans clustering from JSONL data
Project description
UMAP-JSONL
UMAP-JSONL is a command-line tool for generating UMAP plots and KMeans clustering from JSONL data files. This tool leverages UMAP for dimensionality reduction and KMeans for clustering, producing customizable visualizations in PNG format.
Features
- UMAP Visualization: Create 2D UMAP plots from JSONL data.
- KMeans Clustering: Apply KMeans clustering with a configurable number of clusters.
- Customizable Plot Size: Set the figure size for your output plot.
- Flexible Command-Line Interface: Easily configure parameters and specify input/output files.
Installation
You can install UMAP-JSONL using pip
:
pip install umap-jsonl
Usage
To generate a UMAP plot with KMeans clustering, use the following command:
umap-jsonl input_file <input_file> --output_file <output_file> --num_results <num_results> --n_neighbors <n_neighbors> --min_dist <min_dist> --n_components <n_components> --n_clusters <n_clusters> --plot_size <width> <height>
Command-Line Arguments
input_file: Path to the JSONL input file.
--output_file: Path to the output PNG file (default: output.png).
--n_neighbors: Number of neighbors for UMAP (default: 15).
--min_dist: Minimum distance for UMAP (default: 0.1).
--n_components: Number of components for UMAP (default: 2).
--n_clusters: Number of clusters for KMeans (default: 3).
--plot_size: Size of the output plot in inches (default: 8,6). Provide width and height separated by a comma.
Basic usage, provide a .jsonl file as a positional argument
umap-jsonl tests/hf_datasets_100000.jsonl
Advanced usage, set details of umap algorithm, change plot size, etc.
umap-jsonl --input_file data.jsonl --output_file my_plot.png --num_results 10 --n_neighbors 15 --min_dist 0.2 --n_components 2 --n_clusters 4 --plot_size 10 8
Development
To contribute to UMAP-JSONL, clone the repository and install the development dependencies:
git clone https://github.com/david4096/umap-jsonl.git
cd umap-jsonl
pip install -e .
Running Tests
To run tests, use:
python -m unittest discover -s tests
License
This project is licensed under the MIT License - see the LICENSE file for details. Contact
For any questions or issues, please contact David Steinberg at your.email@example.com.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file umap_jsonl-0.1.0.tar.gz
.
File metadata
- Download URL: umap_jsonl-0.1.0.tar.gz
- Upload date:
- Size: 4.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 042d8b776d672b1ee7f3d084a46637086118d4a570e02bc06cfd81b518d0e11a |
|
MD5 | ead06c9fa34376b243244786d11536b2 |
|
BLAKE2b-256 | 3d46f55d877be8a440974bbfe0c66397290bedc7e7a5d95ea77997308985f9b5 |
File details
Details for the file umap_jsonl-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: umap_jsonl-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 67132869aca6d915d9bd19d5e4371c09e8094864ee50b9471c4973aa42b664a4 |
|
MD5 | 119d13c2e12cbfffde698a84768c5345 |
|
BLAKE2b-256 | 3b499e3d5de4b5047cfb7fb0994ca1d2f1024746809d1c68af59afa79396cb18 |