Skip to main content

SUMAP: Supervised UMAP

Project description

SUMAP: Supervised UMAP

sumap makes it easy to tune the parameters of UMAP (Uniform Manifold Approximation and Projection) for enhancement of embedding of high-dimensional data.

Installation

sumap can be installed by running the following command line code:

pip install sumap

General Usage

By creating a sumap.SUMAP() instance, one can set up the search of UMAP hyperparameters in a grid search by prefixing the hyperparameters with umap__.

By default, the optimal UMAP hyperparamters is selected by a SVC classifier.

import sumap

# create sumap instance
mypipeline = sumap.SUMAP(
    umap__n_neigbors=[5, 10] # list of n_neighbors to search
    umap__min_dist=[0, 0.5] # list of min_dist to search
)

Then we can fit the instance with training data:

# fit sumap instance with training data
mypipeline.fit(Xtrain, # Pandas dataframe
               ytrain # Pandas series
               )

The fitted pipeline is stored as a Pipeline object which can be accessed by mypipeline.clf_pipeline.

Alternatively, mypipeline has some attributes as function that allows one to transform data into lower dimensional, and predict the label of data etc.

# transform data to n_components dimension
mypipeline.transform(Xtest)

# predict label
mypipeline.transform(Xtest)

# score the predicted labels, if true labels were given
mypipline.score(Xtest, ytest)

Plotting utilities

In addition, one can access more attributes for easy plotting of the results:

# plot confusion matrix of the classification, if true labels were given
mypipeline.plot_cmatrix(Xtest, ytest)

# plot the optimal umap embeddings and color the labels if given
mypipeline.plot_embeddings(Xtest, ytest)

Links:

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

sumap-0.0.0.dev7.tar.gz (9.5 kB view details)

Uploaded Source

Built Distribution

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

sumap-0.0.0.dev7-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

Details for the file sumap-0.0.0.dev7.tar.gz.

File metadata

  • Download URL: sumap-0.0.0.dev7.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.8

File hashes

Hashes for sumap-0.0.0.dev7.tar.gz
Algorithm Hash digest
SHA256 86293a1cb5d776a1c4905b4acdfcaee141ccd7b4f09ca620b723e053c1ceb58b
MD5 6eeaff76ce9df868d686e49234b23b0a
BLAKE2b-256 bc8b0e2e3a194efdb9e0d537fb20d2ac5eb791543c25a4abb48d639516e6a209

See more details on using hashes here.

File details

Details for the file sumap-0.0.0.dev7-py3-none-any.whl.

File metadata

  • Download URL: sumap-0.0.0.dev7-py3-none-any.whl
  • Upload date:
  • Size: 9.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.8

File hashes

Hashes for sumap-0.0.0.dev7-py3-none-any.whl
Algorithm Hash digest
SHA256 bbfb2cb495f7e972e17c854c6c3778c27d4960975a4d8339bb099eca41343dda
MD5 069c4667fd7052a8152d80196cf3001e
BLAKE2b-256 c2616be2a830b19378f5df9e5c81e3981a798df800a53f71a71da5e9f44a0ee9

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