ApX logoApX logo
ModelsCalculatorHardwareCoursesPricing
ApX logoApX logo
ModelsCalculatorHardwareCoursesPricing

All Courses

Introduction to Neural Networks
Chapter 1: Foundations of Neural Networks
From Biological to Artificial Neurons
Weights and Biases: The Network's Parameters
Activation Functions: Introducing Non-Linearity
Structuring Networks: Layers and Connections
A Simple Feedforward Network Example
Practice: Calculating Neuron Output
Quiz for Chapter 1
Chapter 2: Preparing Data for Neural Networks
Understanding Input Data Representation
Feature Scaling: Normalization and Standardization
Handling Categorical Data: Encoding Techniques
Creating Data Batches for Training
Splitting Data: Training, Validation, and Test Sets
Hands-on Practical: Preprocessing Sample Data
Quiz for Chapter 2
Chapter 3: Forward Propagation: Generating Predictions
The Flow of Information in a Network
Linear Transformation: Weighted Sum Calculation
Applying Activation Functions Layer-wise
Matrix Operations for Efficient Computation
Calculating the Final Output Prediction
Hands-on Practical: Implementing Forward Propagation
Quiz for Chapter 3
Chapter 4: Training: Backpropagation and Gradient Descent
Measuring Performance: Loss Functions
The Concept of Gradient Descent
Backpropagation: Calculating Gradients Efficiently
Updating Weights and Biases
Learning Rate and Its Importance
Stochastic Gradient Descent (SGD) and Variants
Practice: Calculating Gradients Manually
Quiz for Chapter 4
Chapter 5: Building and Training a Basic Neural Network
Setting up the Network Architecture
Initializing Weights and Biases
The Training Loop Structure
Implementing the Training Step
Monitoring Training Progress
Introduction to Deep Learning Frameworks (TensorFlow/PyTorch)
Hands-on Practical: Training a Simple Classifier
Quiz for Chapter 5
Chapter 6: Improving Network Performance and Generalization
Understanding Overfitting and Underfitting
The Role of Validation Sets
Regularization Techniques: L1 and L2
Dropout: Randomly Deactivating Neurons
Early Stopping: Halting Training Optimally
Hyperparameter Tuning Strategies
Practice: Applying Regularization
Quiz for Chapter 6

Practice: Calculating Neuron Output

Calculating the output of a single neuron involves understanding neurons, weights, biases, and activation functions. This process is fundamental, as it is repeated for every neuron in a network during forward propagation.

Recall the two main steps for a neuron's computation:

  1. Linear Combination: Calculate the weighted sum of the inputs plus the bias. We often denote this intermediate value as zzz. z=(∑iwixi)+bz = (\sum_{i} w_i x_i) + bz=(∑i​wi​xi​)+b Where wiw_iwi​ are the weights, xix_ixi​ are the inputs, and bbb is the bias.
  2. Activation: Apply a non-linear activation function fff to the result zzz to get the neuron's final output, denoted as aaa. a=f(z)a = f(z)a=f(z)

Example Calculation

Imagine a single neuron with two inputs. Let's define its parameters and the input values:

  • Inputs: x=[x1,x2]=[2.0,3.0]x = [x_1, x_2] = [2.0, 3.0]x=[x1​,x2​]=[2.0,3.0]
  • Weights: w=[w1,w2]=[0.5,−1.0]w = [w_1, w_2] = [0.5, -1.0]w=[w1​,w2​]=[0.5,−1.0]
  • Bias: b=1.0b = 1.0b=1.0

Step 1: Calculate the Linear Combination (z)

We multiply each input by its corresponding weight, sum these products, and add the bias:

z=(w1×x1)+(w2×x2)+bz = (w_1 \times x_1) + (w_2 \times x_2) + bz=(w1​×x1​)+(w2​×x2​)+b z=(0.5×2.0)+(−1.0×3.0)+1.0z = (0.5 \times 2.0) + (-1.0 \times 3.0) + 1.0z=(0.5×2.0)+(−1.0×3.0)+1.0 z=1.0−3.0+1.0z = 1.0 - 3.0 + 1.0z=1.0−3.0+1.0 z=−1.0z = -1.0z=−1.0

So, the result of the linear combination is z=−1.0z = -1.0z=−1.0.

Visualizing the inputs, weights, and bias feeding into the calculation of the linear combination (zzz) and the subsequent activation (aaa).

Step 2: Apply an Activation Function (f)

Now, we apply an activation function to z=−1.0z = -1.0z=−1.0. The output aaa will depend on which function we choose. Let's calculate the output using the three common functions we discussed: Sigmoid, Tanh, and ReLU.

  • Sigmoid: The Sigmoid function squashes the input into a range between 0 and 1. a=σ(z)=11+e−za = \sigma(z) = \frac{1}{1 + e^{-z}}a=σ(z)=1+e−z1​ a=11+e−(−1.0)=11+e1.0a = \frac{1}{1 + e^{-(-1.0)}} = \frac{1}{1 + e^{1.0}}a=1+e−(−1.0)1​=1+e1.01​ Using e≈2.71828e \approx 2.71828e≈2.71828: a≈11+2.71828=13.71828≈0.2689a \approx \frac{1}{1 + 2.71828} = \frac{1}{3.71828} \approx 0.2689a≈1+2.718281​=3.718281​≈0.2689 So, if using Sigmoid, the neuron's output is approximately 0.26890.26890.2689.

  • Tanh (Hyperbolic Tangent): Tanh squashes the input into a range between -1 and 1. a=tanh⁡(z)=ez−e−zez+e−za = \tanh(z) = \frac{e^z - e^{-z}}{e^z + e^{-z}}a=tanh(z)=ez+e−zez−e−z​ a=e−1.0−e1.0e−1.0+e1.0a = \frac{e^{-1.0} - e^{1.0}}{e^{-1.0} + e^{1.0}}a=e−1.0+e1.0e−1.0−e1.0​ Using e1.0≈2.71828e^{1.0} \approx 2.71828e1.0≈2.71828 and e−1.0≈0.36788e^{-1.0} \approx 0.36788e−1.0≈0.36788: a≈0.36788−2.718280.36788+2.71828=−2.35043.08616≈−0.7616a \approx \frac{0.36788 - 2.71828}{0.36788 + 2.71828} = \frac{-2.3504}{3.08616} \approx -0.7616a≈0.36788+2.718280.36788−2.71828​=3.08616−2.3504​≈−0.7616 If using Tanh, the neuron's output is approximately −0.7616-0.7616−0.7616.

  • ReLU (Rectified Linear Unit): ReLU outputs the input directly if it's positive, and 0 otherwise. a=ReLU(z)=max⁡(0,z)a = \text{ReLU}(z) = \max(0, z)a=ReLU(z)=max(0,z) a=max⁡(0,−1.0)a = \max(0, -1.0)a=max(0,−1.0) a=0a = 0a=0 If using ReLU, the neuron's output is 000.

Summary of Results

For the given inputs x=[2.0,3.0]x = [2.0, 3.0]x=[2.0,3.0], weights w=[0.5,−1.0]w = [0.5, -1.0]w=[0.5,−1.0], and bias b=1.0b = 1.0b=1.0, we first found z=−1.0z = -1.0z=−1.0. The final neuron output aaa depends on the chosen activation function:

  • Using Sigmoid: a≈0.2689a \approx 0.2689a≈0.2689
  • Using Tanh: a≈−0.7616a \approx -0.7616a≈−0.7616
  • Using ReLU: a=0.0a = 0.0a=0.0

This exercise demonstrates the core calculation performed by every artificial neuron. In a real network, the output aaa from this neuron could then become an input xxx for neurons in the next layer. Try changing the input values, weights, or bias and recalculate the outputs using different activation functions to solidify your understanding. This simple operation, repeated many times across layers, is what allows neural networks to process information and learn complex patterns.

© 2026 ApX Machine Learning