Unit 1
Unit 1
FOUNDATIONS
Ms Devibala Subramanian
Assistant Professor
PG & Research Department of Computer Science
Sri Ramakrishna College of Arts and Science
Coimbatore
Deep learning is a subset of machine learning that uses artificial neural networks to model and
process complex patterns in data. It is inspired by the human brain's structure and function,
consisting of multiple layers of interconnected neurons. These networks automatically learn
features from data through a process called backpropagation and optimization techniques like
gradient descent.
Multi-layered Networks: Includes architectures like Convolutional Neural Networks (CNNs) for
image processing and Recurrent Neural Networks (RNNs) for sequential data.
Feature Learning: Extracts relevant patterns from raw data without manual feature engineering.
Scalability: Works efficiently with large datasets and high computational power.
Applications: Used in fields like image recognition, natural language processing (NLP), speech
recognition, autonomous vehicles, and healthcare.
Deep learning has revolutionized AI by enabling advanced capabilities such as real-time language
translation, medical diagnosis, and self-driving technology.
Deep Learning AI mimics the intricate neural networks of the human brain, enabling computers to
autonomously discover patterns and make decisions from vast amounts of unstructured data.
This transformative field has propelled breakthroughs across various domains, from computer
vision and natural language processing to healthcare diagnostics and autonomous driving.
The definition of Deep learning is that it is the branch of machine learning that is based on
artificial neural network architecture.
An artificial neural network or ANN uses layers of interconnected nodes called neurons that work
together to process and learn from the input data.
In a fully connected Deep neural network, there is an input layer and one or more hidden layers
connected one after the other.
Each neuron receives input from the previous layer neurons or the input layer.
The output of one neuron becomes the input to other neurons in the next layer of the network, and
this process continues until the final layer produces the output of the network
The layers of the neural network transform the input data through a series of nonlinear
transformations, allowing the network to learn complex representations of the input data.
Deep learning AI can be used for supervised, unsupervised as well as reinforcement machine
learning. it uses a variety of ways to process these.
Functions
A function is one of the fundamental building blocks in both mathematics and deep learning.
Understanding functions is crucial because neural networks are essentially large, complex functions
that map inputs to outputs.
A function is a rule or process that takes an input (or multiple inputs), applies some transformation
to it, and produces an output. Mathematically, a function is written as:
• f(x)=yf(x) = yf(x)=y
Where:
• x is the input (also called the independent variable).
• f is the function that transforms x.
• y is the output (also called the dependent variable).
Example Functions:
Simple Squaring Function
• f(x)=x2
• Input: x=3
• Output: f(3)=32=9
x = np.array([1, 2, 3, 4])
print(square(x)) # Output: [ 1 4 9 16 ]
3. Composite (Nested) Functions
• In deep learning, functions are often combined to form nested (or composite) functions.
Mathematically:
Each arrow represents a transformation. The derivative of the final output z with respect to x is
computed using the chain rule.
Geometric Intuition (Slope Interpretation)
In deep learning, neural networks consist of multiple layers, where each layer applies a function to
the output of the previous layer. Training a neural network requires computing the derivative of a loss
function with respect to each layer’s parameters using the chain rule.
import numpy as np
def square(x):
return np.power(x, 2)
def sigmoid(x):
return 1 / (1 + np.exp(-x))
A function with multiple inputs takes two or more independent variables and maps them to an
output.
Mathematical Definition
Addition: f(x,y)=x+y
Multiplication: f(x,y)=x * y
import numpy as np
x = np.array([2, 3])
y = np.array([4, 5])
Mathematical Representation:
def weighted_sum(x: np.ndarray, w: np.ndarray) -> np.ndarray:
return np.dot(x, w)
x = np.array([1, 2, 3])
w = np.array([0.1, 0.2, 0.3])
A function with multiple vector inputs takes two or more vectors as inputs and produces an output,
which can be a scalar, vector, or matrix.
Mathematical Representation
If x and y are input vectors, a function with multiple vector inputs can be written as:
import numpy as np
x = np.array([1, 2, 3])
y = np.array([4, 5, 6])
Example: Matrix Multiplication If X is an input matrix and W is a weight matrix, then the
function:
f(X,W)=X⋅W performs a linear transformation.
Python Implementation
print(matrix_multiply(X, W))
Creation of New Features from Existing Features
In a dataset, each feature represents an attribute or characteristic of the data. However, sometimes the
raw features may not be enough to capture useful patterns. By transforming or combining existing
features, we can create new, more informative features that improve learning.
Suppose we are building a house price prediction model. The dataset contains:
Size (sq ft)
Number of rooms Creating New Features:
Age of the house
Distance to city center
houses = pd.DataFrame({
'Size': [1000, 2000, 1500],
'Rooms': [3, 5, 4],
'Age': [5, 20, 50],
'Distance': [2, 10, 5]
})
print(houses)
Feature Creation in Deep Learning
Deep learning models automatically learn new features, but feature engineering can still help.
class FeatureExtractor(nn.Module):
def __init__(self):
super().__init__()
self.fc = nn.Linear(10, 5) # Creates 5 new features from 10 inputs
For a function f(x,y) with two vector inputs x and y, we need to compute the partial derivatives with
respect to each input.
Derivatives help in:
x → [ + ] → a → [ ^2 ] → z
y→[+]