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
shaded-0.1.5.tar.gz 17.7 kB Details

Built distribution (wheel)

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

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

Release history Release notifications | RSS feed

This release

0.1.5 This release

2 release files

0.1.4

2 release files

0.1.3

1 release file

0.1.2

1 release file

0.1.1

1 release file

0.1.0

1 release file

0.0.2

2 release files

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