API reference
Activations
The four activation functions.
Activations is an enum passed to add_dense.
python
from pymlkit import Activations| Member | Formula | Typical use |
|---|---|---|
ReLU | max(0, x) | Hidden layers. |
Sigmoid | 1 / (1 + e^-x) | Single-output binary classification. |
Softmax | e^xᵢ / Σ e^xⱼ | Output layer for multi-class classification. |
Linear | x | Regression outputs. The default. |
The enum also has a
NONE member. It exists for parity with the C library and is not meant for normal use.Choosing one
- Regression: hidden ReLU, output Linear, loss HalfMSE.
- Binary classification: hidden ReLU, output Sigmoid, loss HalfMSE or CrossEntropy.
- Multi-class: hidden ReLU, output Softmax, loss CrossEntropy.
