Skip to main content

No project description provided

Project description

GhostUMAP2

Measuring and Analyzing (r,d)-Stability of UMAP

Installation

git clone https://github.com/jjmmwon/rdumap.git
cd rdumap
hatch shell

How to use GhostUMAP

from rdumap import GhostUMAP
from sklearn.datasets import fetch_openml

mnist = fetch_openml("mnist_784")
X, y = mnist["data"], mnist["target"]

mapper = GhostUMAP()
O, G, active_ghosts = mapper.fit_transform(X, n_ghosts=16) 

mapper.visualize(label=y, legend=[str(i) for i in range(10)])

API

Function 'fit_transform'

def fit_transform(X, n_ghosts, r, ghost_gen, dropping, init_dropping):

Fit X into an embedded space with ghosts and return the transformed outputs.

Parameters

  • X: array, shape (n_samples, n_features) or (n_samples, n_samples). If the metric is 'precomputed' X must be a square distance matrix. Otherwise, it contains a sample per row.

Ghost Configuration

  • n_ghosts: The number of ghost points to embed in the embedding space. Default is 16.
  • r: Radius for ghost generation. Default is 0.1.
  • ghost_gen: Ghost generation parameter. Default is 0.2.

Dropping Scheme

  • dropping: Whether to drop ghosts during optimization. Default is True.
  • init_dropping: Initial dropping parameter. Default is 0.4.

Returns

  • O: array, shape (n_samples, n_components) Embedding of the original data points, identical to the output of UMAP. It represents the transformed coordinates in the low-dimensional space.
  • G: array, shape (n_samples, n_ghosts, n_components) Embedding of ghost points which are clones of the original points. These ghost points are used to evaluate the instability of each data instance.
  • active_ghosts: array, shape (n_samples,) Boolean array indicating the presence of active ghost points for each data instance.

Function 'visualize'

def visualize(title=None, label=None, legend=None):

Returns an interactive visualization widget.

Parameters

  • title: Title of the visualization.
  • label: Labels for the data points.
  • legend: Legend for the visualization.

Returns

  • widget: An interactive visualization widget.

Function 'get_distances'

Get the distances between the original and ghost projections.

def get_distances(sensitivity=1):

Parameters

sensitivity: Sensitivity for distance calculation. Default is 1.

Returns

distances: array, shape (n_samples,). The distances between original and ghost embeddings.

Function 'get_unstable_ghosts'

Get the boolean array indicating unstable ghost points.

def get_unstable_ghosts(distance=0.1, sensitivity=1):

Parameters

distance: Distance threshold for determining instability. Default is 0.1. sensitivity: Sensitivity for instability calculation. Default is 1.

Returns

unstable_ghosts`: array, shape (n_samples,).

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

ghostumap-2.0.1.tar.gz (61.6 kB view details)

Uploaded Source

Built Distribution

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

ghostumap-2.0.1-py2.py3-none-any.whl (2.1 kB view details)

Uploaded Python 2Python 3

File details

Details for the file ghostumap-2.0.1.tar.gz.

File metadata

  • Download URL: ghostumap-2.0.1.tar.gz
  • Upload date:
  • Size: 61.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.28.1

File hashes

Hashes for ghostumap-2.0.1.tar.gz
Algorithm Hash digest
SHA256 a66d202612c089e9ef22d09ebbaffdf134436a9f884a10acaf620d082e71df44
MD5 a37d0619ac430de93a833ba96ca0a2ce
BLAKE2b-256 33c38a985c2a28cbb35031f07f3be2f14f274d09b29a242ec708f0a731dc16af

See more details on using hashes here.

File details

Details for the file ghostumap-2.0.1-py2.py3-none-any.whl.

File metadata

  • Download URL: ghostumap-2.0.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 2.1 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.28.1

File hashes

Hashes for ghostumap-2.0.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 c31703d494aab8f2a326a28318890325af6c04c22ca6ec6f72a43b75494a23c0
MD5 8a05c3307a3a531c2ab209934c4628f6
BLAKE2b-256 6309d9951d0dc3ab4bcafdee5de23f13168f324cd1e7af2e6a1f7a148b25a21d

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