outerspace
An interactive widget for Jupyter notebooks to explore the parameters of t-SNE.
Installation
pip install outerspace
Additionally, if you use jupyter notebook:
jupyter nbextension enable --py widgetsnbextension
... or for jupyter lab:
jupyter labextension install @jupyter-widgets/jupyterlab-manager
jupyter labextension install @bokeh/jupyter_bokeh
Usage
Run t-SNE on the digits data set (see result in the image above):
from outerspace import tsne_playground
from sklearn.datasets import load_digits
digits = load_digits()
X, y = digits.data, digits.target
tsne_playground(X, y)
Show the actual digit images in a tooltip:
from outerspace import tsne_playground, array2d_to_html_img
from sklearn.datasets import load_digits
digits = load_digits()
X, y, images = digits.data, digits.target, digits.images
images = 256 - images * 16 # convert range and invert
images = images.clip(0, 255) # clip values at 255
images = images.astype('uint8') # convert to uint8
images = [array2d_to_html_img(image, resize=(32,32))
for image in images] # convert to HTML images
tsne_playground(X, y,
additional_columns=dict(images=images),
tooltips='@images{safe}') # safe = don't escape HTML
Further examples
Evaluating the chemical space of a set of molecules (with molecule images as tooltip):
from outerspace import tsne_playground, pil_to_html_img
from rdkit.Chem import SDMolSupplier, Draw, AllChem
import requests
import numpy as np
url = ('https://raw.githubusercontent.com/rdkit/rdkit'
'/Release_2020_03/Docs/Book/data/solubility.test.sdf')
response = requests.get(url)
supplier = SDMolSupplier()
supplier.SetData(response.text)
ms = [m for m in supplier]
X = np.array([list(AllChem.GetMACCSKeysFingerprint(m)) for m in ms])
y = [m.GetProp('SOL_classification') for m in ms]
images = [pil_to_html_img(Draw.MolToImage(m, size=(150, 150)))
for m in ms]
tsne_playground(X, y,
additional_columns=dict(images=images),
tooltips='@images{safe}')
Metadata
Release files for outerspace 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| outerspace-0.3.0.tar.gz | 12.1 kB | Without provenance | Details for outerspace-0.3.0.tar.gz |
Release files / outerspace-0.3.0.tar.gz
| Download URL | outerspace-0.3.0.tar.gz |
|---|---|
| Size | 12.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1dd883113a029c41c949e75e2045ef9caf5c1d20f8c8d66ce773f77bc0c4fbbf
|
|
BLAKE2b-256 checksum How to use checksums |
cf1b9046b90e812c99f0fdf29bf7729840a18d68eefccc4ceb144077414e7862
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3.post20200330 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.6.10
|
Security for outerspace 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.