Skip to main content

ji

A toolbox for planar projections (2D embeddings) of high-dimensional data.

To install: pip install ji

Overview

The ji package provides a suite of tools for embedding high-dimensional data into two dimensions using various techniques, including PCA, Isomap, LLE, t-SNE, and more. It is useful for visualization, data compression, and as a preprocessing step for machine learning.

Main Features

  • Dimensionality Reduction: Project high-dimensional data to 2D using a variety of methods.
  • Visualization: Includes a function to create scatter plots of the embedded data.
  • Extensible: Easily add more embedding methods or custom plotting functions.

Usage Examples

Demo: Listing and Using Planarizers

from ji import planarizers
# List available planarizers
print(sorted(planarizers))
# Prepare some data
X = [[1,2,3,4],[4,3,2,1],[0,0,0,0],[1,1,1,1],[2,2,2,2],[3,3,3,3],[4,4,4,4]]
y = [0,1,2,0,1,2,0]
# Use a planarizer that only uses X
pts = planarizers['identity'](X)
print(pts)
# Use a planarizer that arranges points in a circle
pts2 = planarizers['circular'](X)
print(pts2)

Using the analyze Function

The analyze function runs several planarizers and visualizes the results. It uses the planarizers registry, so you can easily add or use custom methods.

from ji import analyze
# Assuming X and y are already defined
analyze(X, y)

If you do not specify X and y, analyze will load a pre-defined digits dataset and perform the analysis on it:

from ji import analyze
analyze()

Custom Plot Function

You can pass a custom plotting function to analyze:

from ji import analyze
import matplotlib.pyplot as plt

def custom_plot(X, y):
    plt.scatter(X[:, 0], X[:, 1], c=y, cmap='viridis', edgecolor='k')
    plt.show()

analyze(plot_fun=custom_plot)

Testing

A test/demo function is provided:

from ji import test_planarizers
test_planarizers()

Documentation

scatter_plot(X, y)

Plots a simple scatter plot of the data.

  • Parameters:
    • X: 2D numpy array, the data points to plot.
    • y: 1D numpy array, the target labels for coloring the points.

analyze(X=None, y=None, plot_fun=scatter_plot, data_name='data', methods=None)

Main function to perform and visualize various embeddings using the planarizers registry.

  • Parameters:
    • X: 2D numpy array, the input data. If None, a default dataset (digits) is loaded.
    • y: 1D numpy array, the target labels corresponding to X. Required if X is not None.
    • plot_fun: Function used to plot the embedding. Defaults to scatter_plot.
    • data_name: String, a name for the dataset to be displayed in plot titles.
    • methods: List of planarizer names to use (defaults to a subset).

This package is designed to be a practical tool in both educational and research settings for those interested in machine learning, data science, and pattern recognition.

Metadata

Release files for ji 0.0.8

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

Source distribution (sdist)

Source distribution for ji 0.0.8
File Size Uploaded
ji-0.0.8.tar.gz 12.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ji 0.0.8
File Interpreter ABI Platform
ji-0.0.8-py3-none-any.whl Python 3 none any Details

Total release size: 25.4 kB

Release files / ji-0.0.8.tar.gz

Download URL ji-0.0.8.tar.gz
Size 12.8 kB
Tags Source
SHA-256 checksum
How to use checksums
9b4cb8ca6db84f123a18c2c4c81da62fd2ca506fe9e9e4f439b2ccf1b7501be1
BLAKE2b-256 checksum
How to use checksums
94a8981c46971dfb0b771d978070e6ad6efe9b6c602692971bed62b5ba1727b8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.10 {"installer":{"name":"uv","version":"0.10.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / ji-0.0.8-py3-none-any.whl

Download URL ji-0.0.8-py3-none-any.whl
Size 12.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c49480289fdd11a881bd661a0b33a2de6413fd2f1ac40fa322a3318bd0334ccc
BLAKE2b-256 checksum
How to use checksums
bcec27c52b1711e43f7648c7dda5b9c1280edd4772331a826ea15512c4acdcd5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.10 {"installer":{"name":"uv","version":"0.10.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

0.0.8 This release

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 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