Skip to main content

wutils

A collection of Python utility functions/classes.

Currently only provides one class: wutils.mat.MarkedMatrix, which is a wrapper around a numpy.array with additional row labels and helper functions.

Can be installed with pip install wutils.

Example

import numpy as np
import matplotlib.pyplot as plt
from wutils.mat import MarkedMatrix

# Create a MarkedMatrix from a tuple of label-matrix tuples
mm = MarkedMatrix((
    ('a', np.random.randn(100, 100)),
    ('b', np.random.randn(50, 100)) # num. of columns must match 'a'
))

# Create a labeled TSNE plot of the components
plt.figure()
mm.tsne()
plt.show()

# Perform SVD on the full matrix
U, _, _ = np.linalg.svd(mm.get_mat(), full_matrices=False)

# Form another MarkedMatrix consisting of the first 2 columns of U.
# We reuse our existing labels
mm_U = MarkedMatrix((U[:, 2], mm.get_loc_idx()))

# Split up the MarkedMatrix to an OrderedDict of label to submatrix
print(mm_U.get_pieces())

# Output:
# OrderedDict([
#     ('a', array([...])),
#     ('b', array([...]))
# ])

# where 'a' is 100 x 2
# and 'b' is 50 x 2

Metadata

Release files for wutils 0.2.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for wutils 0.2.3
File Interpreter ABI Platform Actions
wutils-0.2.3-py3-none-any.whl Python 3 none any Details for wutils-0.2.3-py3-none-any.whl

Release files / wutils-0.2.3-py3-none-any.whl

Download URL wutils-0.2.3-py3-none-any.whl
Size 11.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
51a56514730addf601c7447d14c71b90180febf64db4f5eb38c1468fd3a762f5
BLAKE2b-256 checksum
How to use checksums
4501fa799bfdf46c50c7fdd9c940d0c91463b7905aaa0c3099222aeefd5216ca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.63.0 CPython/3.9.5

Security for wutils 0.2.3

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page