Skip to main content

Dimensionality reduction through Simplified Topological Abstraction of Data

Project description

pySTAD - Python implementation of Simplified Topological Abstraction of Data


pip install stad


The input to stad is a normalised distance matrix (i.e. with values between 0 and 1). Optionally, you can also provide an array of values for each datapoint that can be used in the lens.

Let's for example look at the five circles dataset that is used in the example script below. Without a lens, a stad analysis will reveal a circle with four spikes; with a lens each of these spikes itself also becomes a circle (as in the picture).

The data for this dataset looks like this:


Here's a complete script to create this graph:

import stad
import pandas as pd

## Load the data
url = ''
data = pd.read_csv(url, header=0)

## Extract the values we want to use in our distance, the lens, and optional features
values = data[['x','y']].values.tolist()
lens = data['hue'].map(lambda x:stad.hex_to_hsv(x)[0]).values
xs = data['x'].values.tolist()
ys = data['y'].values.tolist()
hues = data['hue'].values.tolist()

## Create the distance matrix in the high_dimensional space. This can be using
## cosine distance, euclidean, or any other.
highD_dist_matrix = stad.calculate_highD_dist_matrix(values)

## Run STAD and show the result
g = stad.run_stad(highD_dist_matrix, lens=lens, features={'x':xs, 'y':ys, 'hue': hues})

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for stad, version 2.0.1
Filename, size File type Python version Upload date Hashes
Filename, size stad-2.0.1-py3-none-any.whl (8.3 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size stad-2.0.1.tar.gz (7.2 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page