An activation function reshapes a layer’s output so a model can learn useful nonlinear representations. Choose it according to the job of the layer and the allowed output range. section 4.1.3 section 4.3.3
Sentiment classification
A practical classifier uses two Dense layers with 16 units and relu activations, followed by one sigmoid unit. Each relu applies output = relu(dot(input, W) + b) and zeroes negative values. The sigmoid output becomes a score between 0 and 1, suitable for interpreting the review as probably positive or negative. section 4.1.3
Use these practical rules when selecting the final activation:
- Use relu in intermediate Dense layers when the model needs flexible internal representations. section 4.1.3
- Use sigmoid for a single output that should stay between 0 and 1. section 4.1.3
- Use no activation for scalar regression when predictions must cover any numeric range; sigmoid would constrain them to 0–1. section 4.3.3













