Introduction to Deep Learning
- This lesson introduces deep learning concepts and explains how neural networks are used to solve complex AI problems.
Deep Learning Overview
Deep Learning (DL) uses artificial neural networks (ANNs) with many layers to learn hierarchical patterns in data.
Works exceptionally well for large datasets and complex patterns.
Can automatically extract features, reducing the need for manual feature engineering.
Key Characteristics:
Multi-layered neural networks (Deep Neural Networks)
Learns non-linear relationships
Requires large datasets and high computational power
History of Neural Networks
Machine Learning vs Deep Learning
Applications of Deep Learning
AI → ML → DL Relationship
Artificial Intelligence (AI): Broad concept of machines mimicking human intelligence
Machine Learning (ML): Subset of AI, where machines learn from data
Deep Learning (DL): Subset of ML, uses deep neural networks to learn complex patterns
Hierarchy Visualization:
AI
└── ML
└── DL
Simple Neural Network Example (Python / Keras)
Simple Neural Network Example in Python using TensorFlow (XOR Problem)
This Python example demonstrates how to build a simple Neural Network using TensorFlow and Keras to solve the XOR problem. The code creates a Sequential model with one hidden layer and an output layer, compiles it using the Adam optimizer and binary cross-entropy loss, and trains the model on a small dataset. Finally, it evaluates the model and prints the accuracy.
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense
import numpy as np
# Example Dataset (XOR Problem)
X = np.array([[0,0],[0,1],[1,0],[1,1]])
y = np.array([0,1,1,0])
# Step 1: Create Model
model = Sequential()
model.add(Dense(4, input_dim=2, activation='relu')) # Hidden Layer
model.add(Dense(1, activation='sigmoid')) # Output Layer
# Step 2: Compile Model
model.compile(loss='binary_crossentropy', optimizer='adam', metrics=['accuracy'])
# Step 3: Train Model
model.fit(X, y, epochs=500, verbose=0)
# Step 4: Evaluate
loss, accuracy = model.evaluate(X, y)
print("Accuracy:", accuracy)
Output Example:
Accuracy: 1.0
Shows how a small neural network can learn a non-linear XOR pattern.
DL excels when scaling to thousands of neurons and layers with complex data.