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.predict(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.dev8.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.dev8-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sumap-0.0.0.dev8.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.dev8.tar.gz
Algorithm Hash digest
SHA256 11b8efeb879d910c7fc0fc176ce0c2b8c5c18859b100aa76c33c1462552f8587
MD5 51b263ff2685b6a54c078e109cf7db1c
BLAKE2b-256 7932787239d4fa5520ae10b87399523792619e2e77e448b68e79fdb11d30f7ae

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sumap-0.0.0.dev8-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.dev8-py3-none-any.whl
Algorithm Hash digest
SHA256 439702aad072f4db1d5f9eecce195a16f9e6d97e447cb40ccaaea8e8cf7a7976
MD5 b2e2b2327067c5274c5946ec8005607c
BLAKE2b-256 875ae95dc60708d47d8f82746a7f9afa65624f239d68be8aee4305b2f7b610d6

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