Metadata-Version: 2.4
Name: stdplus_ext
Version: 0.0.1
Summary: The stdplus activation function
Author: Yujia Yan
License: MIT
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# stdplus

`stdplus(x)` is a smooth activation function for computing **Gaussian standard deviations** in variational models. It is designed as a numerically stable alternative to `softplus` / `exp`, and is introduced in *Chapter 6* of Yujia Yan’s PhD dissertation (University of Rochester, 2025).  
It resembles a **1-centered softplus** (i.e., equals 1 at `x = 0`) while providing a clean analytic derivative and a stable evaluation recipe. 


## Definition 

stdplus function is defined as a function y = f(x) such that
$$y^2- 2 \log(y) - 1 = x^2$$

This is proposed in Chapter 6 of Yujia Yan's dissertation: Slashed Normal Parameterization for Approximate Normal Posterior Distributions


## Why stdplus?

In the **Slashed Normal / KL-amplitude** parameterization, Gaussian parameters are expressed as a complex “KL amplitude” `ψ = a + bi`, and the standard deviation is computed with:

- `μ = sqrt(2) * a`
- `σ = stdplus(sqrt(2) * b)` 

This yields an exact closed-form KL term equal to `||ψ||_2^2` (enabling direct, interpretable rate control). 

## Reference

- Yujia Yan, *Structured Analysis and Generation in Music, Audio, and Beyond*, PhD Dissertation, University of Rochester, 2025. (See Chapter 6, Sec. 6.6 “More on stdplus Function”.) 


## Install 
pip3 install -e .

