Skip to main content

shaded

shaded provides tools for linear spectral feature extraction and dimension reduction, with a focus on fast, interpretable projections for machine learning and signal processing.


Features

  • PseudoLda: Fast, approximate Linear Discriminant Analysis (LDA) using class centers.
  • PseudoPca: Fast, approximate Principal Component Analysis (PCA) using random hyperplanes.
  • PairwiseLda: LDA projections for every pair of classes.
  • Chained Spectral Projectors: Compose multiple projection methods in sequence.
  • Band Projection Matrix: Utilities for frequency band bucketing and projection.
  • Linear Algebra Utilities: Null space, projection, and residue computations.

Installation

pip install shaded

Usage Examples

PseudoLda: Fast LDA-like Projection

from shaded.pseudo_lda import PseudoLda
from sklearn.datasets import load_iris

X, y = load_iris(return_X_y=True)
plda = PseudoLda(n_components=2)
plda.fit(X, y)
X_proj = plda.transform(X)
print(X_proj.shape)  # (n_samples, 2)

PseudoPca: Fast PCA-like Projection

from shaded.pseudo_pca import PseudoPca

ppca = PseudoPca(n_components=2)
ppca.fit(X)
X_proj = ppca.transform(X)
print(X_proj.shape)  # (n_samples, 2)

PairwiseLda: LDA for All Class Pairs

from shaded.pair_wise_lda import PairwiseLda

pwlda = PairwiseLda(n_components=2)
pwlda.fit(X, y)
X_proj = pwlda.transform(X)
print(X_proj.shape)

Chained Spectral Projectors

Chain multiple projections (e.g., PCA followed by LDA):

from shaded.chained_spectral_projector import GeneralProjectionLearner

chain = (
    {'type': 'pca', 'args': {'n_components': 3}},
    {'type': 'lda', 'args': {'n_components': 2}},
)
gpl = GeneralProjectionLearner(chain=chain)
X_proj = gpl.fit_transform(X, y)
print(X_proj.shape)  # (n_samples, 5)

Band Projection Matrix

Create frequency band buckets and projection matrices:

from shaded.band_projection_matrix import make_band_proj_matrix

proj_matrix = make_band_proj_matrix(n_buckets=5, n_freq=20)
print(proj_matrix.shape)  # (5, 20)

API Overview

  • PseudoLda: Fast LDA-like projection for well-separated clusters.
  • PseudoPca: Fast PCA-like projection using random hyperplanes.
  • PairwiseLda: LDA projections for all class pairs.
  • GeneralProjectionLearner: Chain and compose projections (PCA, LDA, etc.).
  • band_projection_matrix: Create frequency band buckets and projection matrices.
  • linalg_utils: Linear algebra helpers (null space, projection, residue).

Testing

Unit tests are provided for core linear algebra and projection utilities. To run tests:

pytest shaded/tests/

License

[Specify your license here]


Let me know if you want to add more advanced examples or further API details!

Metadata

Release files for shaded 0.1.5

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

Source distribution (sdist)

Source distribution for shaded 0.1.5
File Size Uploaded Provenance Actions
shaded-0.1.5.tar.gz 17.7 kB Without provenance Details for shaded-0.1.5.tar.gz

Built distribution (wheel)

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

Total release size: 37.6 kB

Release files / shaded-0.1.5.tar.gz

Download URL shaded-0.1.5.tar.gz
Size 17.7 kB
Tags Source
SHA-256 checksum
How to use checksums
3bcc54c728de97730b6f36f197e15e615c9539df34bc8570da43b375a5d61fdb
BLAKE2b-256 checksum
How to use checksums
073cd890121bb279038d3007cf64d432269597035d7794d23b9efa3a37f337d5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.18

Release files / shaded-0.1.5-py3-none-any.whl

Download URL shaded-0.1.5-py3-none-any.whl
Size 19.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f55a29aa9fa3406b0be614aac2a06efd308d8b404aa923a51f4bbde8f089a86e
BLAKE2b-256 checksum
How to use checksums
0eec18f85441b8a0014dc27d16539da2916e85497dd017675d569809efaa401f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.18

Security for shaded 0.1.5

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