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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
11b8efeb879d910c7fc0fc176ce0c2b8c5c18859b100aa76c33c1462552f8587
|
|
| MD5 |
51b263ff2685b6a54c078e109cf7db1c
|
|
| BLAKE2b-256 |
7932787239d4fa5520ae10b87399523792619e2e77e448b68e79fdb11d30f7ae
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
439702aad072f4db1d5f9eecce195a16f9e6d97e447cb40ccaaea8e8cf7a7976
|
|
| MD5 |
b2e2b2327067c5274c5946ec8005607c
|
|
| BLAKE2b-256 |
875ae95dc60708d47d8f82746a7f9afa65624f239d68be8aee4305b2f7b610d6
|