This release is a pre-release and may not be stable for production use.
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:
Release files for sumap 0.0.0.dev8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| sumap-0.0.0.dev8.tar.gz | 9.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sumap-0.0.0.dev8-py3-none-any.whl | Python 3 | none | any | Details |
Total release size:18.6 kB
Release files / sumap-0.0.0.dev8.tar.gz
| Download URL | sumap-0.0.0.dev8.tar.gz |
|---|---|
| Size | 9.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
11b8efeb879d910c7fc0fc176ce0c2b8c5c18859b100aa76c33c1462552f8587
|
|
BLAKE2b-256 checksum How to use checksums |
7932787239d4fa5520ae10b87399523792619e2e77e448b68e79fdb11d30f7ae
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Release files / sumap-0.0.0.dev8-py3-none-any.whl
| Download URL | sumap-0.0.0.dev8-py3-none-any.whl |
|---|---|
| Size | 9.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
439702aad072f4db1d5f9eecce195a16f9e6d97e447cb40ccaaea8e8cf7a7976
|
|
BLAKE2b-256 checksum How to use checksums |
875ae95dc60708d47d8f82746a7f9afa65624f239d68be8aee4305b2f7b610d6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|