Skip to main content

A Python toolkit for dimensionality reduction quality assessment

Project description

pyDRMetrics

pyDRMetrics is a Python toolkit for DR (dimensionality reduction) quality assessment. Add a reference to this article if you use this package. pyDRMetrics - A Python toolkit for dimensionality reduction quality assessment, Heliyon, Volume 7, Issue 2, 2021, e06199, ISSN 2405-8440, https://doi.org/10.1016/j.heliyon.2021.e06199. (https://www.sciencedirect.com/science/article/pii/S2405844021003042) A more friendly GUI tool using pyDRMetrics can be accessed at http://spacs.brahma.pub/research/DR

Installation

pip install pyDRMetrics

How to use

Download some sample datasets from the /data folder Use the following sample code to use the package:

# import the library
from pyDRMetrics.pyDRMetrics import *

# load the dataset
import pandas as pd
data = pd.read_csv('raman.csv')
cols = data.shape[1]
# convert from pandas dataframe to numpy matrices
X = np.array(data.iloc[:,1:-1]) # skip first and last cols
y = np.array(data.iloc[:,-1])
X_names = list(data.columns.values[1:-1]) # -1 for removing the last column
labels = list(set(y))

# perform DR, e.g., PCA
from sklearn.decomposition import PCA
import matplotlib.ticker as mticker
K = 2
pca = PCA(n_components = K) # keep the first K components
pca.fit(X)
Z = pca.transform(X)
Xr = pca.inverse_transform(Z)

# Create DRMetrics object. This object contains all DR metrics and main API functions
drm = DRMetrics(X, Z, Xr)
drm.report() # this will generate a detailed report. You can also access each metric, e.g., drm.QNN, drm.LCMC, etc.

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

pyDRMetrics-0.0.5.tar.gz (8.4 kB view details)

Uploaded Source

Built Distribution

pyDRMetrics-0.0.5-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

File details

Details for the file pyDRMetrics-0.0.5.tar.gz.

File metadata

  • Download URL: pyDRMetrics-0.0.5.tar.gz
  • Upload date:
  • Size: 8.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/1.5.0 pkginfo/1.8.2 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6

File hashes

Hashes for pyDRMetrics-0.0.5.tar.gz
Algorithm Hash digest
SHA256 e7a10e0f8c8fbb8868aa9366d77b27c79c3d0afbc89be39cb1e54379a8b334ae
MD5 4b97229fb36eca8d176cc5ea95a10038
BLAKE2b-256 766009ecd7f03b78f887202ea3bf21c0c3b0619b6172709ae555e07e4ab06fe2

See more details on using hashes here.

File details

Details for the file pyDRMetrics-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: pyDRMetrics-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 10.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/1.5.0 pkginfo/1.8.2 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6

File hashes

Hashes for pyDRMetrics-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 30b4cbefaeff38d79773bf2d4f9595b4f62df990e3d4fccff0835494c2edde93
MD5 4e4f14bfc38623f74b493e77f52d5a02
BLAKE2b-256 fac27386ffdad77c6408f8b4d5d35254b8722e70fea6dd1bc87bbae13139d153

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page