Skip to main content

Python Implementation of the Glimmer algorithm for multidimensional scaling

Project description

PyGlimmerMDS

A python implementation of the Glimmer algorithm for multidimensional scaling (MDS).

Glimmer performs dimensionality reduction on high-dimensional data sets of many instances, avoiding the quadratic runtime behavior of naive MDS implementations by employing a multilevel (coarse to fine) approach. This implementation does not utilize the GPU, but gives considerable speedup nonetheless and makes MDS on large data sets feasible.

Glimmer is a metric MDS and uses Euclidean distance in the high-dimensional space as the dissimilarity measure.

Installation

pip install PyGlimmerMDS

or if you want to install a specific commit use

pip install git+https://github.com/hageldave/PyGlimmerMDS@<commit_hash>

How to use

Jittering the Iris data set to produce a data set of 38,400 points. Performing Glimmer on this data set.

from pyglimmermds import Glimmer, execute_glimmer
from sklearn import preprocessing as prep
from sklearn import datasets
import numpy as np
import matplotlib.pyplot as plt

# get iris data
dataset = datasets.load_iris()
data = dataset.data
labels = dataset.target
# duplicate data with added noise
for _ in range(8):
  data = np.vstack((data,data+(np.random.rand(data.shape[0], data.shape[1])*0.2-.1)))
  labels = np.append(labels,labels)
print(data.shape)
print(labels.shape)
# perform MDS
data = prep.StandardScaler().fit_transform(data)
mds = Glimmer(decimation_factor=2, stress_ratio_tol=1 - 1e-5)
projection = mds.fit_transform(data) # alternative: execute_glimmer(data)
# show scatter plot
fig, ax = plt.subplots()
scatter = ax.scatter(projection[:, 0], projection[:, 1], c=labels, s=1)
ax.axis('equal')
plt.show(fig)

glimmer_iris

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

pyglimmermds-0.0.2.tar.gz (6.6 kB view details)

Uploaded Source

Built Distribution

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

pyglimmermds-0.0.2-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

Details for the file pyglimmermds-0.0.2.tar.gz.

File metadata

  • Download URL: pyglimmermds-0.0.2.tar.gz
  • Upload date:
  • Size: 6.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.12

File hashes

Hashes for pyglimmermds-0.0.2.tar.gz
Algorithm Hash digest
SHA256 66aa9cd09eb44e18bd4907b3540838dbc55a6ad4599db2c771daccc022b8732b
MD5 b28177bc51e186c2855917db8609d3b4
BLAKE2b-256 4117d9a5677d0f70de625d7b95346734782cd72e71b8b1479c9e299a0555f9dc

See more details on using hashes here.

File details

Details for the file pyglimmermds-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: pyglimmermds-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 8.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.12

File hashes

Hashes for pyglimmermds-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 dc710d451851c1704bbcdd728d6b7f15a690150ee868ff36a0d4bb83b43d549f
MD5 377de9cd20d7b73b0a278d072d2f7fc7
BLAKE2b-256 8dc5155c7aa3dcb8a91ce36faabbaaa151793db366d97b242417fadddb8cac04

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