Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Principle:Tensorflow Tfjs Activation Functions

From Leeroopedia
Revision as of 17:14, 16 February 2026 by Admin (talk | contribs) (Auto-imported from principles/Tensorflow_Tfjs_Activation_Functions.md)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


Knowledge Sources
Domains Deep_Learning, Neural_Network_Architecture
Last Updated 2026-02-10 06:00 GMT

Overview

Non-linear mathematical functions applied element-wise to layer outputs, enabling neural networks to learn complex decision boundaries beyond linear transformations.

Description

Activation functions introduce non-linearity into neural networks. Without them, any composition of linear layers collapses to a single linear transformation, severely limiting the models representational capacity. TensorFlow.js Layers implements the standard set of activation functions (ReLU, sigmoid, tanh, softmax, etc.) as both standalone classes and string-referenced configurations for use in layer definitions.

Advanced activations like LeakyReLU, PReLU, ELU, ThresholdedReLU, and Softmax are implemented as full Layer subclasses because they carry learnable parameters or require more complex computation than a simple element-wise function.

Usage

Use activation functions when building any neural network architecture. Select based on the layer position and task:

  • ReLU for hidden layers (default choice)
  • Sigmoid for binary classification output
  • Softmax for multi-class classification output
  • Tanh for outputs needing range [-1, 1]
  • LeakyReLU/PReLU when dying neuron problem is a concern

Theoretical Basis

Common activation functions:

ReLU(x)=max(0,x)

Sigmoid(x)=11+ex

Softmax(xi)=exijexj

ELU(x)={xif x>0α(ex1)if x0

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment