Introduction

Welcome back to our course Neural Network Fundamentals: Neurons and Layers! In this third lesson, we're building upon what you learned in our previous lesson about the basic artificial neuron. You've already implemented a simple neuron that computes a weighted sum of inputs plus a bias.

Today, we're taking an important step forward by introducing activation functions — a crucial component that enables neural networks to learn complex patterns. In particular, we'll focus on the Sigmoid activation function, one of the classical functions used in neural networks.

In our previous lesson, our neuron could only produce linear outputs. While this is useful for some tasks, it severely limits what our neural networks can learn. Today, we'll overcome this limitation by adding non-linearity to our neurons, allowing them to model more complex relationships in data.

The Need for Non-Linearity
Understanding Activation Functions

An activation function determines whether a neuron should be "activated" or not, based on the weighted sum of its inputs.

In biological terms, this mimics how neurons in our brains "fire" when stimulated sufficiently. In computational terms, activation functions introduce non-linearity into the network, allowing it to learn complex patterns.

Activation functions typically have these characteristics:

  • They are non-linear, allowing the network to model complex relationships.
  • They are differentiable, which is important for the training process (we'll explore this in future lessons).
  • They usually map inputs to a bounded range (like [0,1] or [-1,1]).

Some common activation functions include:

  • Sigmoid: Maps inputs to values between 0 and 1.
  • Tanh: Maps inputs to values between -1 and 1.
  • ReLU (Rectified Linear Unit): Returns the input if positive; otherwise, returns 0.

Here is the visualization of neural network activation functions:
In this lesson, we'll focus on implementing and using the Sigmoid function, which was historically one of the first activation functions used in neural networks.

Sign up
Join the 1M+ learners on CodeSignal
Be a part of our community of 1M+ users who develop and demonstrate their skills on CodeSignal