AI & ML
Dr Rahul
AI & ML
Syllabus Theory
Theory 45
Practical 30
Books
Introduction
• "What comes to mind when you hear 'Artificial Intelligence’?”
Sci-Fi Vs Reality
• "In science fiction, AI often takes the form of sentient robots, super-
intelligent beings, or even threats to humanity. While those stories
are exciting, the reality of AI today is very different. We're not talking
about conscious machines or robots that look and act exactly like
humans."
"Instead, modern AI is about highly sophisticated computer programs
designed to perform specific tasks that, in the past, only humans could
do. It's about algorithms, data, and problem-solving, not sentience or
emotions."
Definition
• Working Definition: "AI is a field of computer science that enables machines
to perform tasks that typically require human intelligence."
• Key phrase to highlight: "Tasks that typically require human intelligence." This is the
core
• Analogy: Think of "Intelligence" as the big umbrella. AI is just one way to
achieve intelligence, specifically artificial intelligence.
• Narrow vs. General AI:
• Narrow AI (ANI): AI designed for a specific task (e.g., playing chess,
recommending movies, recognizing faces). Most of the AI we see today is
narrow AI.
• General AI (AGI): Hypothetical AI that can perform any intellectual task that
a human being can.
Key Subfields – The "How" of AI:
• Machine Learning (ML):
• "Teaching computers to learn from data without being explicitly
programmed."
• Analogy: Imagine teaching a child to recognize a cat. You show them many
pictures of cats and non-cats, and they learn the patterns. ML works similarly.
• Briefly mention types of ML (no deep dive):
• Supervised Learning: Learning from labeled examples (e.g., spam/not spam).
• Unsupervised Learning: Finding patterns in unlabeled data (e.g., grouping customers).
• Reinforcement Learning: Learning by trial and error, receiving rewards for good actions
(e.g., AI playing games)
• 3. How Neural Networks Learn
• Forward Propagation
• Input data passes through layers → produces an output (prediction).
• Loss Function
• Compares prediction vs. actual answer.
• Example: Mean Squared Error (regression), Cross-Entropy (classification).
• Backward Propagation (Backpropagation)
• Errors flow backward.
• Adjusts the weights (using Gradient Descent) to improve accuracy.
• Repeat many times (epochs) until predictions are good.
• 4. Simple Example
• Suppose we want a network to recognize if an image is a cat (1) or not a cat
(0):
• Input Layer: Pixels of the image.
• Hidden Layer: Detect edges, shapes, eyes, ears, etc.
• Output Layer: Probability → 0.9 (Cat), 0.1 (Not Cat).
• 5. Key Concepts
• Weights: Strength of connections between neurons.
• Bias: Extra adjustable parameter for flexibility.
• Activation Function: Adds non-linearity (so network can learn complex
things).
• Epochs: One full cycle of training on all data.
• 6. Types of Neural Networks
• Feedforward NN (FNN): Basic, info flows forward only.
• Convolutional NN (CNN): For images & computer vision.
• Recurrent NN (RNN): For sequences like text & speech.
• Transformers: Advanced NNs for NLP (like GPT).
Deep Learning (DL)
• Definition:
Deep Learning is a subset of Machine Learning that uses Artificial Neural
Networks (ANNs) with many layers (hence “deep”).
It automatically learns features and patterns from raw data without needing
manual feature extraction.
• Key Ideas:
• Inspired by the structure of the human brain (neurons & connections).
• Uses multiple layers: Input → Hidden Layers → Output.
• Each layer extracts higher-level features (e.g., from pixels → edges → shapes → objects).
• Requires large datasets and high computational power (GPUs/TPUs).
• Examples:
• Image recognition (Google Photos tagging people).
• Voice assistants (Siri, Alexa).
• Self-driving cars (detecting lanes, traffic lights, pedestrians).
• GPU vs TPU in AI
• GPU (Graphics Processing Unit)
• Originally designed for: Rendering graphics in gaming & video.
• Now used for: AI/ML because it can perform parallel processing (many
small calculations at once).
• Strengths:
• Excellent for deep learning training (huge datasets + big models).
• Flexible → supports many types of tasks (vision, NLP, simulations).
• Available from companies like NVIDIA, AMD.
• Example: Training a CNN for image classification on NVIDIA RTX 4090
GPU.
• TPU (Tensor Processing Unit)
• Full form: Tensor Processing Unit.
• Designed by: Google (for TensorFlow & AI tasks).
• Optimized for: Matrix multiplications & tensor operations (core of deep
learning).
• Strengths:
• Extremely fast for training & inference of neural networks.
• Uses reduced precision (bfloat16, int8) to save time and power.
• Available via Google Cloud Platform (GCP).
• Example: Running a large Transformer (like BERT or GPT) on Google TPU
v4 in the cloud.
Natural Language Processing (NLP)
• Definition:
NLP is a branch of AI that enables computers to understand, interpret, and
generate human language.
It deals with text, speech, and linguistics.
• Key Concepts:
• Tokenization: Splitting text into words or sentences.
• Stemming/Lemmatization: Reducing words to their root form (e.g., running → run).
• Word Embeddings: Representing words as vectors (Word2Vec, GloVe).
• Transformers & Large Language Models (LLMs): Modern NLP models (like GPT) that
understand context.
• Examples:
• Machine translation (Google Translate).
• Sentiment analysis (detecting positive/negative reviews).
• Chatbots & Virtual Assistants.
• Text summarization and question answering.
Transformers
• Introduced in 2017 by Google A deep learning architecture designed mainly
for sequence data (like text, speech).
• It replaced older NLP models like RNNs and LSTMs.
• Key Idea: Attention Mechanism
• Instead of reading text word by word (like RNNs), transformers look at the
entire sequence at once.
• They use self-attention to decide which words are important in relation to
each other.
• Example:
Sentence: The cat sat on the mat because it was tired.
• “it” → Attention mechanism figures out that “it” refers to “cat,” not “mat.”
• Why Transformers are powerful?
• Handle long-range dependencies in text.
• Highly parallelizable (fast training).
• Scales very well with data + computation.
Large Language Models (LLMs)
• LLMs are AI models trained on huge text datasets (billions or even trillions of words).
• They are built using transformer architecture.
• Learn grammar, facts, reasoning, and even problem-solving from raw data.
• Examples of LLMs
• GPT (OpenAI) – powers ChatGPT.
• BERT (Google) – good at understanding context.
• LLaMA (Meta).
• Gemini (Google DeepMind).
• Capabilities of LLMs
• Text generation (ChatGPT writing answers, stories).
• Translation (English → Hindi).
• Summarization (condense a news article).
• Question answering.
• Code generation (GitHub Copilot).
• What is GitHub Copilot?
• A coding assistant developed by GitHub + OpenAI.
• Powered by a Large Language Model (LLM) (Codex, based on GPT).
• Works inside code editors (like VS Code, JetBrains).
• Provides autocomplete, suggestions, and code snippets as you type.
• How It Works
• Training
• Trained on billions of lines of public code (from GitHub + other sources).
• Learns programming languages, libraries, and coding patterns.
• Context Understanding
• Reads the current file, function name, comments, and previous code.
• Predicts the most likely next code snippet (like autocomplete but much smarter).
• Output
• Suggests code, function definitions, loops, test cases, or even whole modules.
• Visual Studio Code (VS Code)
• Developed by Microsoft.
• A lightweight, open-source, cross-platform code editor.
• Very popular among students, beginners, and professionals.
• Key Features
• Free & Open Source
Supports many languages (Python, C, C++, Java, JS, etc.)
Extensions Marketplace – install plugins (like Python, GitHub Copilot, Docker).
Integrated Terminal – run code directly in the editor.
Debugging Tools – set breakpoints, watch variables.
Git Integration – commit, push, and manage repositories.
Customizable – themes, keyboard shortcuts.
• When to Use VS Code?
• Great for students, web developers, and data scientists.
• Works well for lightweight projects, scripting, and multi-language coding.
JetBrains IDEs
• Developed by JetBrains (a Czech company).
• Family of full-featured IDEs (Integrated Development Environments).
• Examples:
• PyCharm (Python)
• IntelliJ IDEA (Java, Kotlin)
• CLion (C/C++)
• PhpStorm (PHP)
• WebStorm (JavaScript, React, Angular)
• Key Features
• Rich IDE (heavier than VS Code) – comes with built-in tools for specific
languages.
Smart Code Completion (predicts whole lines, not just words).
•
• Refactoring Tools – safely rename, restructure code.
Advanced Debugging & Profiling – very detailed.
Version Control – Git, Mercurial, Subversion.
Database Tools – connect directly to MySQL, PostgreSQL, etc.
Paid (with student license free).
• When to Use JetBrains IDEs?
• Best for professional software development.
• Ideal when working on large projects in a single language (like enterprise-
level Java apps).
• More powerful but heavier compared to VS Code.
• What is GPT?
• GPT stands for Generative Pre-trained Transformer.
It is a type of Large Language Model (LLM) developed by OpenAI.
• 1. Expansion
• Generative → It can generate text (not just analyze).
• Pre-trained → It is trained on a massive dataset first (books, web, Wikipedia,
code, etc.), then fine-tuned for tasks.
• Transformer → Uses the Transformer architecture (self-attention mechanism)
for understanding context in language.
• 2. How GPT Works
• Input: A sequence of words (prompt).
• Process: Uses self-attention to understand relationships between words.
• Output: Predicts the next word/token step by step.
• Example:
Prompt = "The capital of France is"
GPT predicts: "Paris".
• 3. Versions
• GPT-1 (2018): Proof of concept (117M parameters).
• GPT-2 (2019): Much larger (1.5B parameters), could write essays.
• GPT-3 (2020): Huge (175B parameters), strong at reasoning, coding, NLP tasks.
• GPT-4 (2023): Multimodal (text + images), better reasoning, safety.
• GPT-5 (latest, 2025): Even more advanced in reasoning, creativity, and problem-solving.
• 4. Applications
• Chatbots (like ChatGPT )
• Code generation (GitHub Copilot)
• Text summarization
• Question answering
• Translation
• Content creation (articles, emails, poetry, etc.)
• 5. Key Strength
• Unlike rule-based systems, GPT learns patterns of language automatically from data → making it
flexible for almost any text-based task.
• In short:
GPT = AI that reads, understands, and generates human-like text using the Transformer architecture
• What is Computer Vision?
• Computer Vision (CV) is a field of Artificial Intelligence that enables
machines to see, interpret, and understand images or videos, just like
humans do.
• Goal: Extract meaningful information from visual data and make decisions
based on it.
• How Computer Vision Works
• Image Acquisition – Take input from a camera, video, or dataset.
• Preprocessing – Resize, filter, normalize images to remove noise.
• Feature Extraction – Detect important details (edges, colors, shapes,
textures).
• Understanding/Recognition – Identify objects, classify images, detect
movement.
• Key Techniques in Computer Vision
• Image Processing Basics
• Edge detection (e.g., Canny, Sobel filters).
• Noise reduction (blurring, smoothing).
• Thresholding & segmentation (separating objects from background).
• Machine Learning for Vision
• Use ML algorithms to classify images (e.g., cat vs dog).
• Deep Learning for Vision (Modern CV)
• Convolutional Neural Networks (CNNs): Specialized for image recognition.
• Object Detection Models: YOLO, Faster R-CNN, SSD.
• Image Segmentation Models: U-Net, Mask R-CNN
• Applications of Computer Vision
• Face Recognition → Phone unlocking, surveillance.
• Medical Imaging → Tumor detection in X-rays/MRIs.
• Self-Driving Cars → Detect lanes, traffic lights, pedestrians.
• Retail → Amazon Go (checkout-free stores).
• Agriculture → Crop health monitoring using drones.
• Simple Analogy
• Eyes → Camera (capture data).
• Brain → CV algorithms (analyze & interpret).
Where Do We See AI? Applications and Impact
• Where you encounter AI in your daily lives.
• Personalized Recommendations: Netflix, Amazon, Spotify.
• Virtual Assistants: Siri, Alexa, Google Assistant.
• Search Engines: Google Search (ranking results).
• Social Media: Content feeds, facial tagging.
• Healthcare: Disease diagnosis, drug discovery.
• Finance: Fraud detection, algorithmic trading.
• Transportation: Self-driving cars (basic concepts), route optimization.
• Education: Personalized learning platforms, automated grading.
• The "Fuel" of AI: Data and Algorithms Data is King: Emphasize that AI models learn from vast
amounts of data.
• "Garbage in, garbage out" – the quality and bias of data are crucial.
• Algorithms as Recipes: AI uses algorithms (sets of rules or instructions) to process data and make
decisions or predictions.
• The Learning Loop: Data → Algorithm → Model → Prediction/Action → (often) More Data for
Improvement.
Ethical Considerations and the Future of AI
• Beyond the Hype: The Responsible Use of AI.
• Key Ethical Concerns :
• Bias: AI models can inherit biases present in the training data, leading to unfair or
discriminatory outcomes (e.g., facial recognition misidentifying certain
demographics).
• Privacy: Collection and use of vast amounts of personal data raise privacy
concerns.
• Job Displacement: Automation by AI may impact certain job sectors.
• Accountability & Transparency: Who is responsible when an AI makes a mistake?
Can we understand why an AI made a particular decision (explainability)?
• Misinformation/Deepfakes: Generative AI can create realistic fake content.
• What is Bias in AI?
• Bias in AI means the system produces results that are unfair, prejudiced, or
systematically favor one group over another.
• It usually happens because the training data is biased or the model design
introduces bias.
• Examples of Bias in AI
• 1. Face Recognition Bias
• Many early face recognition systems worked better for light-skinned people
than for dark-skinned people.
• Reason: Training datasets had more white faces than black or Asian faces.
• 2. Hiring/Recruitment Bias
• An AI hiring tool (e.g., Amazon’s 2018 system) downgraded resumes that
included words like “women’s chess club”.
• Reason: It was trained on past resumes, mostly from men → learned a gender
bias.
• Healthcare Bias
• An AI system predicting who needs extra medical care gave lower scores to
black patients compared to white patients.
• Reason: It used healthcare spending as a proxy for health, but historically less
money is spent on black patients.
• 4. Language Model Bias
• An NLP model might complete:
• “The nurse said ___” → “she”
• “The engineer said ___” → “he”
• Shows gender stereotype bias in text generation.
• Why Bias Happens?
• Training Data Bias: If the dataset is not diverse.
• Historical Bias: Past human decisions carry discrimination.
• Measurement Bias: Using wrong features (like healthcare spending instead of
actual health).
• Representation Bias: Minority groups underrepresented.
Thanks