# Activation function

> Canonical: https://skillalmanac.com/glossary/activation-function | Last verified: 2026-11-24 | Index status: index-eligible

An activation function transforms values within a neural network. Nonlinear activations let stacked transformations represent nonlinear relationships; a linear identity activation is also possible. The function, output range and placement depend on the architecture and task.

Also called: activation functions, neural network activation function, nonlinear activation, activation function in deep learning.

## In plain language

An activation function is the small rule at each node of a neural network that decides how much of its signal to pass on. Picture a dimmer switch rather than an on-off switch: the node adds up its inputs and the function reshapes that total before it moves forward. Composing only affine transformations still gives an affine transformation; nonlinear activations can make a layered network more expressive. The choice of function is a design decision and a poor one can slow or stall training. Google's crash course recommends starting with ReLU. The choice affects training time, which is a cost on large models.

## Technical definition

A standard dense unit applies an activation after an affine combination of inputs. Sigmoid maps finite real inputs into (0,1), tanh into (-1,1), and ReLU returns max(0,x). Activations need not all be nonlinear: Keras also provides a linear identity activation. ReLU is nonlinear and piecewise linear, with a nondifferentiable point at zero.

## How it shows up when you use agents

Activation functions appear when you or an agent write or read network code, for example a PyTorch or TensorFlow model definition where a line between two layers names ReLU, sigmoid or tanh.

Reading that line is the practical skill. If a network with many layers behaves like a plain linear model, check whether the relevant computation includes nonlinear operations. If the loss stops falling early, the choice of function and the [learning rate](/glossary/learning-rate) are two of the first things to look at, since CS231n notes that ReLU units can die when the learning rate is too high.

What breaks when it is misunderstood: people treat the function as a minor detail and copy a different one from another project without checking the output range. A sigmoid on the last layer gives values between 0 and 1, which suits a probability and not an unbounded number. A sensible next action is to start with ReLU in hidden layers, as Google suggests, change one thing at a time and compare on held-out data. See [Neural network](/glossary/neural-network) and [Backpropagation](/glossary/backpropagation).

## Worked example (illustrative)

For inputs −2 and 2, ReLU returns 0 and 2, whereas an identity activation returns −2 and 2. ReLU is not restricted to outputs between zero and one and is not differentiable at zero. These evaluated formulas illustrate different activation choices; no network was trained or compared for task performance.

## Common confusions

- **Activation function versus loss function.** The activation shapes each node's output during the forward pass. The loss measures the error of the final output and drives training.
- **Activation function versus perceptron threshold.** A perceptron's hard step is one early kind of activation. Other activations include smooth sigmoid and tanh and nonsmooth ReLU. See [Perceptron](/glossary/perceptron).
- **Sigmoid versus ReLU.** Sigmoid squashes values into 0 to 1 and ReLU passes positive values unchanged. Google says it still recommends starting with ReLU. Sigmoid can saturate, which can make gradients small; suitability depends on the layer and task.
- **Myth.** Any function will do. Without a nonlinear one, stacked layers stay linear, per Google's crash course.

## Worked examples in this catalogue

### [huggingface-datasets](https://skillalmanac.com/skills/huggingface/huggingface-datasets)

Status: illustrative example from the item's own documentation, not executed for this page.

What you see: Hugging Face datasets read through the Dataset Viewer API, with metadata, rows, search and filters.

Why it exercises the concept: This linked skill helps inspect data. It does not choose activations or train a neural network; it is preparation rather than a demonstration of the function.

### [split-leakage-check](https://skillalmanac.com/skills/skill-almanac/split-leakage-check)

Status: illustrative example from the item's own documentation, not executed for this page.

What you see: A check of train, validation and test files for duplicates, shared groups, time and label leakage, printed as JSON.

Why it exercises the concept: Not a training skill. When you try different activation functions you compare them on held-out data, and a leaky split would make the choices look better than it is.

### [data-analysis-eda](https://skillalmanac.com/skills/skill-almanac/data-analysis-eda)

Status: illustrative example from the item's own documentation, not executed for this page.

What you see: A fixed exploratory-analysis procedure and CSV profiler that keeps findings descriptive, evidenced and caveated.

Why it exercises the concept: Not a training skill. Profiling your table first shows how the inputs are scaled, which is background you need before reading any training log.

### [Claude Code](https://skillalmanac.com/tools/claude-code)

Status: illustrative example from the item's own documentation, not executed for this page.

What you see: Claude Code's overview page describes it as an agentic coding tool that reads your codebase, edits files and runs commands.

Why it exercises the concept: You can ask a coding agent to write a tiny network in PyTorch or scikit-learn, swap ReLU for tanh in one line and compare the training logs yourself.

## Related terms

- [Neural network](https://skillalmanac.com/glossary/neural-network.md)
- [Perceptron](https://skillalmanac.com/glossary/perceptron.md)
- [Backpropagation](https://skillalmanac.com/glossary/backpropagation.md)
- [Deep learning](https://skillalmanac.com/glossary/deep-learning.md)
- [Gradient descent](https://skillalmanac.com/glossary/gradient-descent.md)
- [Learning rate](https://skillalmanac.com/glossary/learning-rate.md)

## Sources

- [Neural networks: Activation functions](https://developers.google.com/machine-learning/crash-course/neural-networks/activation-functions), Google for Developers (Machine Learning Crash Course) (accessed 2026-11-24)
- [CS231n Convolutional Neural Networks for Visual Recognition: Neural Networks Part 1](https://cs231n.github.io/neural-networks-1/), Stanford University (accessed 2026-11-24)
- [What is a neural network?](https://www.ibm.com/think/topics/neural-networks), IBM (accessed 2026-11-24)
- [Layer activations: linear identity and ReLU](https://keras.io/api/layers/activations/#linear-function), Keras (accessed 2026-11-24)

Definitions are written by Skill Almanac from the sources above and checked against them on 2026-11-24. [Glossary index](https://skillalmanac.com/glossary.md).
