Artificial intelligence • Original RRTutors lesson
Artificial Neural Networks and Perceptrons
Understand layers of weighted computations, nonlinear activations, and learned parameters.
Concept and explanation
A neuron computes a weighted combination of inputs, adds a bias, and applies an activation function. Stacking layers can represent complex functions when nonlinearities are included. A single perceptron only learns linearly separable decision boundaries; architecture and training data constrain what a network can learn.
How to apply it
Trace tensor shapes through the model, define a loss aligned with the task, and compare outputs with a simple baseline.
Worked example
An image classifier maps pixel tensors through learned feature transformations to class scores.
Illustrative Python example
import torch.nn as nn
model = nn.Sequential(
nn.Linear(4, 8),
nn.ReLU(),
nn.Linear(8, 2),
)
print(model)
Expected result
The network maps four input features through a hidden layer to two output scores.
Limitations and cautions
More layers do not guarantee better learning; data quality, optimization, and evaluation remain essential.
Practice exercise
Draw the dimensions of each layer and explain why an activation is needed between linear layers.
Key takeaway: Neural networks are parameterized function approximators whose behavior must be measured.