Skip to main content

PSANN: Parameterized Sine-Activated Neural Networks (sklearn-style, PyTorch backend)

Project description

PSANN - Parameterized Sine-Activated Neural Networks

Sklearn-style estimators built on PyTorch that use learnable sine activations, optional persistent state, and shared helpers for episodic (HISSO) training.

Quick links:

  • API reference: docs/API.md
  • Technical design notes: TECHNICAL_DETAILS.md
  • Scenario walkthroughs: docs/examples/README.md

Installation

python -m venv .venv
.\.venv\Scripts\Activate.ps1   # Windows PowerShell
# source .venv/bin/activate     # macOS/Linux
pip install --upgrade pip
pip install -e .                # editable install from source

Extras defined in pyproject.toml:

  • psann[sklearn]: adds scikit-learn for real BaseEstimator mixins and metrics
  • psann[viz]: plotting helpers used in notebooks/examples
  • psann[dev]: pytest, ruff, black

Need pre-pinned builds (e.g. on Windows or air-gapped envs)? Use the compatibility constraints:

pip install -e . -c requirements-compat.txt

pyproject.toml is the authoritative dependency list. requirements-compat.txt mirrors the newest widely available wheels for NumPy, SciPy, and scikit-learn when you need lockstep installs.

Quick Start

Supervised regression

import numpy as np
from psann import PSANNRegressor

rs = np.random.RandomState(42)
X = np.linspace(-4, 4, 1000, dtype=np.float32).reshape(-1, 1)
y = 0.8 * np.exp(-0.25 * np.abs(X)) * np.sin(3.5 * X)

model = PSANNRegressor(
    hidden_layers=2,
    hidden_units=64,
    epochs=200,
    lr=1e-3,
    early_stopping=True,
    patience=20,
    random_state=42,
)
model.fit(X, y, verbose=1)
print("R^2:", model.score(X, y))

Supervising extras outputs

Append extra columns to y or pass them separately. Extra heads are scheduled automatically when extras>0.

extras = np.stack([np.cos(X[:, 0]), np.sin(X[:, 0])], axis=1).astype(np.float32)
y_with_extras = np.concatenate([y[:, None], extras], axis=1)

model = PSANNRegressor(hidden_layers=2, hidden_units=64, extras=2)
model.fit(X, y_with_extras, verbose=1)

For streaming/time-series, LSM preprocessors, segmentation heads, and HISSO workflows, head to docs/examples/README.md.

Feature Highlights

  • Learnable sine activations (SineParam) with amplitude, frequency, and decay bounds
  • Shared _fit helper powering PSANN, residual PSANN, and language-model estimators
  • Optional predictive extras with automatic target detection and rollout utilities
  • Stateful controllers for streaming inference with warm-start and reset policies
  • Convolutional variants that preserve spatial structure and support per-element outputs
  • HISSO episodic training with reward hooks, supervised warm starts, and extras scheduling

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

psann-0.9.18.tar.gz (170.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

psann-0.9.18-py3-none-any.whl (83.5 kB view details)

Uploaded Python 3

File details

Details for the file psann-0.9.18.tar.gz.

File metadata

  • Download URL: psann-0.9.18.tar.gz
  • Upload date:
  • Size: 170.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for psann-0.9.18.tar.gz
Algorithm Hash digest
SHA256 218b60fd300001735ee1142f8a3180eb743a6ec89682e23802b6ab8005b4bb20
MD5 473ee80727e66c202320562f82a57abc
BLAKE2b-256 ce0845c2b1de82bafb3b1c30f393bcf0d24bd0afd6d19b7bd3113d83ad2a5187

See more details on using hashes here.

File details

Details for the file psann-0.9.18-py3-none-any.whl.

File metadata

  • Download URL: psann-0.9.18-py3-none-any.whl
  • Upload date:
  • Size: 83.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for psann-0.9.18-py3-none-any.whl
Algorithm Hash digest
SHA256 a185217babf67052fd66e188a56f3a039db4ec8abd51d0dc069c7aa3a14024c5
MD5 d4a81b49efb928c4f7172bfd8b4fe20a
BLAKE2b-256 5233f39c38cd3b76931eb1cda6bfae90368043c3db4d9ff23ed9bf3b0dfddc47

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page