# Sigmoid/softmax Transforms

A Statistics concept (Normalization & distribution) in the LuxAlgo Library, with 2 indicator implementations.

## What are Sigmoid/softmax Transforms?

Sigmoid transforms are S-shaped functions that squash an unbounded input into a fixed interval. The logistic function maps any real number into the open interval from 0 to 1; the hyperbolic tangent maps into minus 1 to plus 1; arctangent variants behave similarly. Near zero the mapping is close to linear, and it saturates toward the bounds as inputs grow, so ordinary readings keep their differences while outliers are compressed against the rails.

The functions are old mathematics wearing new jobs: the logistic curve dates to nineteenth-century growth modeling, tanh and arctangent are standard analysis, and softmax's name spread through the machine-learning literature, where it serves as the output layer that turns scores into class probabilities. Indicator work borrowed all of them for the same reason ML did, differentiable, monotonic squashing with tunable steepness.

Softmax is the vector version: it exponentiates a list of scores and divides each result by the sum of the results, producing positive weights that add up to one, which reads like a probability across competing alternatives. In indicator work, sigmoids appear wherever an unbounded series needs a bounded display, most famously the [inverse Fisher transform](https://www.luxalgo.com/library/concept/inverse-fisher-transform/), which pushes a scaled oscillator through the hyperbolic tangent so readings crowd near the extremes. The transform reshapes a series; it adds no new information.

The working parameter is the gain (in softmax, the temperature): a multiplier applied before the squash that sets how quickly the function saturates. High gain turns the sigmoid toward a step function, pinning readings at the rails and making the display nearly binary; low gain keeps it near-linear and gentle. The same dial governs softmax's decisiveness, concentrating weight on the top score or spreading it evenly, which is why the pre-scaling, commonly a [Z-score](https://www.luxalgo.com/library/concept/z-score/) standardization, is as much a design choice as the function itself.

## How to read a sigmoid-transformed indicator

The squash changes the geometry, not the content; reading one means knowing what was fed in and how hard it was squeezed.

1. Identify the input series and its pre-scaling: a tanh of a z-scored momentum and a tanh of raw momentum are different animals with the same shape.
2. Note the bounds and midline: 0-to-1 transforms center on 0.5, tanh-style transforms on zero, and the midline crossing is the input's own zero cross.
3. Read saturation as regime: readings pinned against a rail mean the input is large by its own recent standards, and time spent at the rail is the persistence read.
4. Watch departures from the rails: with extreme-hugging shapes, the informative event is usually the reading leaving the extreme, not sitting at it.
5. Treat thresholds as portable: the whole point of bounding is that a 0.9 means the same thing across instruments, provided the pre-scaling was standardized.

## How traders use it

- To bound unbounded oscillators (momentum differences, volume deltas, regression slopes), usually standardized first as a [Z-score](https://www.luxalgo.com/library/concept/z-score/), so fixed thresholds and cross-instrument comparisons make sense.
- To reshape an oscillator's behavior: tanh-style shaping makes readings spend more time pinned near the extremes, so departures from an extreme zone stand out more clearly.
- To turn raw scores into weights: softmax over several signal or regime scores yields a normalized weighting for [ensemble voting](https://www.luxalgo.com/library/concept/ensemble-voting-of-signals/), and a logistic squash maps a single score onto a 0-to-1 confidence-style scale.
- To soften switches: passing a regime score through a gentle sigmoid converts a hard on/off gate into a graded blend, so strategies scale in and out of conditions instead of toggling at a threshold.
- To build bounded displays: standardized deviations squashed into a fixed interval drive heat-style backgrounds and meters that stay legible across symbols, the display-layer cousin of a [percentile rank](https://www.luxalgo.com/library/concept/percentile-rank/).

## Sigmoid squashing vs other normalizations

- **Z-score** (https://www.luxalgo.com/library/concept/z-score/): The z-score standardizes location and scale but stays unbounded, so outliers still stretch the axis. The sigmoid is the complementary step: applied after standardization, it fixes the display range while preserving ordinary readings' differences.
- **Percentile Rank** (https://www.luxalgo.com/library/concept/percentile-rank/): Rank bounds a series empirically, by counting where the value sits in its own history, with no functional form at all. The sigmoid bounds analytically, by formula, keeping magnitude information near the center that rank deliberately discards.

## FAQ

### What is the difference between sigmoid and softmax?

A sigmoid squashes one number into a bounded interval, such as 0 to 1 for the logistic function or minus 1 to 1 for tanh. Softmax takes a whole set of numbers and converts them into positive weights that sum to one, distributing emphasis across alternatives. Loosely, a sigmoid answers a yes-or-no question and softmax answers a which-one question.

### Why apply a sigmoid to a trading indicator at all?

Bounding buys three things: fixed thresholds that mean the same on every instrument, protection against a single outlier stretching the scale, and, with tanh-style shaping, extremes that hug the rails so turns away from them are easier to see. It cannot improve the underlying signal, only its scaling; a noisy input stays noisy after the squash.

### What is the difference between the logistic function and tanh?

Range and centering, mostly: the logistic maps into 0-to-1 around a 0.5 midline, tanh into minus-1-to-1 around zero, and the two are related by a simple rescaling. For oscillators, tanh's symmetric range reads naturally for two-sided quantities like momentum, while the logistic's 0-to-1 range suits confidence-style scores and weights.

### What does the gain or temperature parameter control?

Saturation speed. Multiplying the input before the squash steepens the S: high gain drives readings to the rails on modest inputs, making the output nearly binary, while low gain keeps the mapping gentle and informative through the middle. In softmax the same role is played by temperature, deciding whether weights concentrate on the top score or spread across alternatives.

### Does squashing lose information?

At the extremes, deliberately: once readings saturate, further input growth barely moves the output, so magnitude distinctions among outliers are compressed away. That is the design trade, robustness and fixed scale in exchange for tail resolution. Where the size of extremes matters, analysts keep the pre-squash series alongside, or use rank-based views that preserve ordering.

### How does the inverse Fisher transform relate to these functions?

It is the tanh squash under its trading name: John Ehlers' technique scales an oscillator (RSI is the classic input), pushes it through the hyperbolic tangent, and gets a bounded line that hugs its extremes and crosses the middle quickly. The design goal was decisiveness, cleaner extreme zones and sharper departures, which is exactly the reshaping role sigmoids play generally.

## Implementations in the Library

- ArcTan Oscillator (LuxAlgo): https://www.luxalgo.com/library/indicator/arctan-oscillator/
- Sigmoid Transition Trailing Stop (LuxAlgo): https://www.luxalgo.com/library/indicator/sigmoid-transition-trailing-stop/

## Related concepts

- Distribution-of-returns Profiling: https://www.luxalgo.com/library/concept/distribution-of-returns-profiling/
- Percentile Rank: https://www.luxalgo.com/library/concept/percentile-rank/
- Min-max Scaling: https://www.luxalgo.com/library/concept/min-max-scaling/
- Standard Deviation: https://www.luxalgo.com/library/concept/standard-deviation/
- Z-score: https://www.luxalgo.com/library/concept/z-score/
- Winsorization: https://www.luxalgo.com/library/concept/winsorization/
- Distribution Moments: https://www.luxalgo.com/library/concept/distribution-moments/
- Normality Testing: https://www.luxalgo.com/library/concept/normality-testing/
- Outlier Detection: https://www.luxalgo.com/library/concept/outlier-detection/

---

Source: https://www.luxalgo.com/library/concept/sigmoid-softmax-transforms/ (LuxAlgo Library, the encyclopedia of trading & technical analysis). Free to use with attribution: https://www.luxalgo.com/library/license/