Metadata-Version: 2.5
Name: psann
Version: 2.0.1
Summary: PSANN: Parameterized Sine-Activated Neural Networks (primary-output, sklearn-style, PyTorch backend)
Project-URL: Homepage, https://github.com/Nickm1128/psann
Project-URL: Repository, https://github.com/Nickm1128/psann
Project-URL: Issues, https://github.com/Nickm1128/psann/issues
Project-URL: Documentation, https://github.com/Nickm1128/psann/tree/main/docs
Project-URL: Changelog, https://github.com/Nickm1128/psann/blob/main/CHANGELOG.md
Project-URL: Contributing, https://github.com/Nickm1128/psann/blob/main/docs/CONTRIBUTING.md
Author: Nicholas Milinkovich
License: MIT License
        
        Copyright (c) 2025 Nicholas Milinkovich
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Keywords: classification,neural-networks,pytorch,regression,sine,siren,sklearn,time-series
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.9
Requires-Dist: numpy>=1.23
Requires-Dist: pyyaml>=6.0
Requires-Dist: torch>=2.1
Provides-Extra: compat
Requires-Dist: numpy==1.26.4; extra == 'compat'
Requires-Dist: scikit-learn==1.4.2; extra == 'compat'
Requires-Dist: scipy==1.11.4; extra == 'compat'
Requires-Dist: torch==2.1.2; extra == 'compat'
Provides-Extra: dev
Requires-Dist: black>=24.0; extra == 'dev'
Requires-Dist: build>=1.2; extra == 'dev'
Requires-Dist: coverage[toml]>=7.5; extra == 'dev'
Requires-Dist: ipython>=8.0; extra == 'dev'
Requires-Dist: mypy>=1.10; extra == 'dev'
Requires-Dist: pre-commit>=3.6; extra == 'dev'
Requires-Dist: pytest-json-report>=1.5; extra == 'dev'
Requires-Dist: pytest>=7.0; extra == 'dev'
Requires-Dist: ruff>=0.5.0; extra == 'dev'
Provides-Extra: sklearn
Requires-Dist: scikit-learn<1.5,>=1.2; extra == 'sklearn'
Provides-Extra: viz
Requires-Dist: matplotlib>=3.7; extra == 'viz'
Description-Content-Type: text/markdown

# PSANN

PSANN is a PyTorch library for regression with trainable sinusoidal activations, composed preprocessing, and episodic optimization. The separate `psannlm` distribution provides language modeling.

Version **2.0.1** is on the authoritative 2.x API track for both packages. New code should use the typed configuration interfaces shown here. Older constructors and flat configuration inputs are migration-only compatibility routes and are not part of the canonical public surface.

## Install from this checkout

Use Python 3.9 or newer. Install a PyTorch build appropriate for your CPU or CUDA runtime before installing PSANN.

```sh
python -m pip install -e ".[sklearn]"
# Add language modeling when needed:
python -m pip install ./psannlm
```

`psann` depends on NumPy, PyTorch, and PyYAML. Scikit-learn is optional for cloning and model selection. Installing core alone does not install or expose `psannlm`. See the [installation and LM guide](https://github.com/Nickm1128/psann/blob/main/docs/lm.md) for tokenizer and training dependencies.

## Regression

```python
import torch  # Initialize PyTorch before optional scientific packages on Windows.
import numpy as np
from psann import PSANNRegressor
from psann.architectures import ArchitectureConfig

X = np.linspace(-1, 1, 64, dtype=np.float32)[:, None]
y = np.sin(3 * X).astype(np.float32)
model = PSANNRegressor(
    architecture=ArchitectureConfig.dense(),
    hidden_layers=1, hidden_units=16, epochs=8,
    batch_size=16, lr=0.01, random_state=7, device="cpu",
)
model.fit(X, y)
predictions = model.predict(X)
model.save("regression.pt")
restored = PSANNRegressor.load("regression.pt", map_location="cpu")
np.testing.assert_allclose(restored.predict(X), predictions, rtol=0, atol=0)
```

Use nested architecture policies to select residual, convolutional, wave, sequence, or geometric-sparse behavior. Use `PreprocessorConfig` for LSM composition and `EpisodicTrainer(estimator=..., strategy=HISSOConfig(...))` for episodic training. Language modeling uses `PSANNLM`, `PSANNLMDataPrep`, `LMConfig`, and `LMArchitectureConfig`, with `python -m psannlm` as its CLI.

## Find a workflow

- [Documentation index](https://github.com/Nickm1128/psann/blob/main/docs/README.md): task guides and reference.
- [Executable quickstarts](https://github.com/Nickm1128/psann/blob/main/examples/quickstarts.py): regression, preprocessing, episodic optimization, and LM training; each saves and reloads twice.
- [Architecture contract](https://github.com/Nickm1128/psann/blob/main/docs/architecture_contract.md): supported combinations and validation.
- [API reference](https://github.com/Nickm1128/psann/blob/main/docs/API.md): construction, fit, inference, and persistence.
- [Migration](https://github.com/Nickm1128/psann/blob/main/docs/migration.md) and [deprecation policy](https://github.com/Nickm1128/psann/blob/main/docs/deprecation_policy.md): compatibility routes for older applications and checkpoints.
- [Changelog](https://github.com/Nickm1128/psann/blob/main/CHANGELOG.md), [contributing](https://github.com/Nickm1128/psann/blob/main/docs/CONTRIBUTING.md), and [license](https://github.com/Nickm1128/psann/blob/main/LICENSE).

Research examples illustrate experiments; they do not establish general accuracy or performance advantages. Historical result reports are labeled and are not current executable configurations.
