Docsity

Artificial Intelligence Fundamentals II, Study notes of Artificial Intelligence

Toggle sidebar
bg1
In one sentence:
Machine Learning takes a dataset, learns useful patterns and relationships
through computation, and uses the learned knowledge to make a decision or
prediction for new data.
When Should We Use Machine Learning vs Deep
Learning?
The simple answer is:
Use traditional Machine Learning when the data is relatively structured
and the problem can be solved well with engineered features. Use Deep
Learning when you have large amounts of complex data and need the
model to learn features automatically.
1. When to Use Machine Learning?
Traditional ML algorithms include:
• Decision Tree
• Random Forest
• K-Nearest Neighbors (KNN)
• Support Vector Machine (SVM)
• Linear Regression
• Logistic Regression
• Naive Bayes
• XGBoost
Use Machine Learning when:
1. Data is small or medium-sized Example:
You have student data for 5,000 students:
• Attendance
• Study hours
• Internal marks
• Assignment marks
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19

Partial preview of the text

Download Artificial Intelligence Fundamentals II and more Study notes Artificial Intelligence in PDF only on Docsity!

In one sentence: Machine Learning takes a dataset, learns useful patterns and relationships through computation, and uses the learned knowledge to make a decision or prediction for new data.

When Should We Use Machine Learning vs Deep

Learning?

The simple answer is: Use traditional Machine Learning when the data is relatively structured and the problem can be solved well with engineered features. Use Deep Learning when you have large amounts of complex data and need the model to learn features automatically.

1. When to Use Machine Learning?

Traditional ML algorithms include:

  • Decision Tree
  • Random Forest
  • K-Nearest Neighbors (KNN)
  • Support Vector Machine (SVM)
  • Linear Regression
  • Logistic Regression
  • Naive Bayes
  • XGBoost **Use Machine Learning when:
  1. Data is small or medium-sized** Example: You have student data for 5,000 students :
  • Attendance
  • Study hours
  • Internal marks
  • Assignment marks
  • Previous marks You want to predict: Pass / Fail Traditional ML such as Decision Tree or Random Forest can work very well. 2. Data is structured/tabular For example: Age Salary Experience Loan 25 30,000 2 No 35 60,000 8 Yes 42 80,000 15 Yes This is structured/tabular data. Machine Learning is often a very good choice. 3. You have limited computational resources Deep Learning models can require:
  • Powerful GPUs
  • Large memory
  • Longer training time If you have limited computing resources, traditional ML may be more practical. 4. You need interpretability Suppose a bank wants to understand: "Why was this customer's loan rejected?" A Decision Tree can provide relatively understandable rules such as: Income < ₹30,

Credit Score < 600 ↓

Traditional ML would generally require manually designed image features. Deep Learning can learn useful visual representations automatically from training data.

3. Feature extraction is difficult This is a major advantage of Deep Learning. Traditional ML: Raw Data ↓ Feature Engineering ↓ ML Algorithm ↓ Prediction A human often needs to decide which features are useful. Deep Learning: Raw Data ↓ Deep Neural Network ↓ Automatically learns representations ↓ Prediction For example, in image recognition, the network can learn increasingly complex representations through its layers.

Simple Example: Student Prediction vs Face Recognition

Problem 1: Student Pass/Fail Data:

  • Attendance
  • Study hours
  • Internal marks
  • Assignment marks This is structured data.

Use Machine Learning. For example: Random Forest → Pass/Fail Problem 2: Face Recognition Input: Face Image The system needs to understand:

  • Edges
  • Shapes
  • Eyes
  • Nose
  • Face structure
  • Complex visual patterns Deep Learning is usually preferred. For example: Image → CNN/Deep Learning → Person/Face identified

Another Example: Traffic Management

Since you are working with traffic-management examples, this is a very useful distinction. Situation A: Traffic Prediction Suppose your dataset contains: Time Vehicle Count Speed Weather Traffic 8 AM 850 25 km/h Clear High 10 AM 400 45 km/h Clear Low You want to predict:

Very Simple Rule for Students

Remember this: Structured Data → Machine Learning Example: Age + Salary + Experience → Loan Prediction Complex/Unstructured Data → Deep Learning Example: Image → Deep Learning → Cat/Dog But there is an important exception: Deep Learning can also work with structured/tabular data , and traditional ML can work with text or image data after feature extraction. So don't memorize: "ML = tables and DL = images" as an absolute rule. Instead remember: Choose the simplest method that gives good performance for your data, problem, resources, and requirements. One-line classroom explanation: Machine Learning is often preferred for smaller, structured datasets and problems where useful features can be engineered easily, while Deep Learning is especially useful for large-scale, complex data such as images, video, audio, and natural language where automatic feature learning is valuable. WHAT IS MEAN BY MODAL

What is a Model in Machine Learning?

In Machine Learning, a model is the learned representation of patterns and relationships from data that can be used to make predictions or decisions. Simple Example: Student Pass/Fail

Suppose we give the ML algorithm this training data: Study Hours Attendance Result 2 60% Fail 3 65% Fail 5 80% Pass 6 85% Pass The Machine Learning algorithm studies this data and learns the relationship between: Study Hours + Attendance → Result After learning, it creates a model. Then we give new data: Study Hours = 5 Attendance = 82% The model uses what it learned and predicts: PASS Very Simple Definition A Machine Learning model is the result of training an algorithm on data, which allows it to make predictions or decisions on new data. Think of it like a student: Training Data → Student studies examples Learning Algorithm → Student learns patterns Model → Student's learned knowledge New Data → New exam question Prediction → Student gives the answer So: Data → Algorithm learns → Model → New Data → Prediction

  1. Supervised Learning
  2. Unsupervised Learning
  3. Semi-Supervised Learning

1. Supervised Learning

Definition Supervised Learning is a type of machine learning in which the model is trained using labeled data. Here, we already know the correct answer/output for the training examples. Simple idea: Input + Correct Output → Learning → Model Example: Student Pass/Fail Study Hours Attendance Result 2 60% Fail 3 65% Fail 5 80% Pass 6 85% Pass Here:

  • Study Hours, Attendance = Input/Features
  • Pass/Fail = Label/Target The model learns the relationship between the input and the known output. Now give: Study Hours = 5 Attendance = 82% The model predicts:

Pass Common Supervised Learning Algorithms For Classification:

  • Decision Tree
  • Random Forest
  • K-Nearest Neighbors (KNN)
  • Support Vector Machine (SVM) • Logistic Regression
  • Naive Bayes For Regression:
  • Linear Regression
  • Decision Tree Regression
  • Random Forest Regression
  • Support Vector Regression Applications
  • Spam email detection
  • Disease prediction
  • Student result prediction
  • House price prediction
  • Credit/loan approval
  • Image classification

2. Unsupervised Learning

Definition Unsupervised Learning is a type of machine learning in which the model is trained using unlabeled data. Here, we do not provide the correct answer to the model. The algorithm tries to discover:

  • Patterns
  • Groups
  • Similarities
  • Relationships
  • Hidden structures in the data.
  • Apriori Algorithm Applications
  • Customer segmentation
  • Market basket analysis
  • Anomaly detection
  • Grouping similar documents
  • Image segmentation
  • Finding hidden patterns in data

3. Semi-Supervised Learning

Definition Semi-Supervised Learning uses a combination of a small amount of labeled data and a large amount of unlabeled data. This is useful when obtaining labels is expensive, difficult, or timeconsuming. Simple idea: Small Labeled Dataset + Large Unlabeled Dataset → Learning → Model

Example: Medical Image Classification

Suppose a hospital has: 10,000 X-ray images But doctors have manually labeled only: 500 images For example: X-ray Label Image 1 Pneumonia Image 2 Normal Image 3 Pneumonia

... ... Image 500 Normal The remaining 9,500 images are unlabeled. A semi-supervised learning method can use: 500 labeled images + 9,500 unlabeled images to build a model. Why is this useful? Labeling medical images requires expert doctors and can take significant time and effort. So instead of labeling all 10,000 images, we can use a smaller labeled dataset together with the large unlabeled dataset.

Simple Comparison

Feature Supervised Unsupervised Semi-Supervised Labeled data Required Not required Small amount Unlabeled data Usually not necessary Used Large amount Correct output provided? Yes No For some data Main purpose Prediction Find patterns Prediction using limited labels Example Spam detection Customer grouping Medical image classification Common technique Classification/Regression Clustering Semi-supervised classification

Very Easy Example

Imagine you have 100 pictures of fruits. Supervised Learning

"Here is the question and here is the correct answer. Learn from it." Unsupervised No teacher, find the pattern yourself. "Here is the data. Find groups or patterns." Semi-Supervised Teacher gives only some answers. "I will label a few examples; use those along with the many unlabeled examples." One-line summary: Supervised Learning learns from labeled data, Unsupervised Learning discovers patterns from unlabeled data, and Semi-Supervised Learning combines a small amount of labeled data with a large amount of unlabeled data. HOW SEMISUPERVISED LEARNING EXACTLY WORKS WHICH ALGORITHMS ARE USED

Semi-Supervised Learning: How Exactly Does It Work?

Semi-supervised learning (SSL) is used when we have:

  • A small amount of labeled data → we know the correct answer
  • A large amount of unlabeled data → we don't know the answer The basic idea is: Learn from the labeled examples first, then use the information/patterns in the unlabeled examples to improve the model.

1. Simple Example

Suppose we have 10,000 medical X-ray images. Only 1,000 images are labeled by doctors: X-ray Label

Image 1 Pneumonia Image 2 Normal Image 3 Pneumonia ... ... X-ray Label Image 1000 Normal The remaining 9,000 images have no labels. So: 1,000 labeled + 9,000 unlabeled This is an ideal situation for semi-supervised learning.

2. How Does It Work?

A common SSL process looks like this: DATA ↓ ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”“ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā” ↓ ↓ Labeled Data Unlabeled Data ↓ ↓ Known Answers Unknown Answers ↓ ↓ ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¬ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜ ↓ Semi-Supervised Method ↓ Learned Model ↓ Prediction / Decision Let's understand the process more deeply.

Step 4: Generate Pseudo-Labels

This is one of the most common ideas in semi-supervised learning. If the model is highly confident about an unlabeled example, we can temporarily treat its prediction as a pseudo-label. For example: Image 1001 → Pneumonia → 98% confidence We can assign: Pseudo-label = Pneumonia Similarly: Image 1002 → Normal → 96% confidence But: Image 1003 → Pneumonia → 52% confidence We may not use it yet , because the model is uncertain.

Step 5: Combine the Data

Now we have: Original labeled data 1,000 labeled images Pseudo-labeled data Suppose we obtained 6,000 reliable pseudo-labels. Now we effectively have: 1,000 real labels + 6,000 pseudo-labels The model can be trained again using this larger dataset.

Step 6: Improve the Model

After retraining: Model → Better predictions The improved model can then predict labels for more unlabeled data. This process may be repeated. Labeled Data ↓ Initial Model ↓ Predict Unlabeled Data ↓ Select High-Confidence Predictions ↓ Generate Pseudo-Labels ↓ Combine Data ↓ Retrain Model ↓ Improved Model This approach is called Pseudo-Labeling / Self-Training.

3. What Algorithms Are Used?

There is no single algorithm called "Semi-Supervised Learning." Instead, semi-supervised learning is a learning setting/approach , and several algorithms can be used. Important methods include:

1. Self-Training / Pseudo-Labeling This is one of the easiest to understand. Process: Labeled Data