Unit - 1 Introduction to machine learning
CHAPTER 1
INTRODUCTION TO MACHINE LEARNING**
1.1 Overview of Human Learning and Machine Learning
Human Learning
Human learning is a natural process where people gain knowledge from experience, observation, practice, and reasoning.
For example:
-
A child learns to recognize animals by seeing pictures.
-
A driver learns to drive better with practice.
Humans learn using the brain, emotions, and thinking abilities.
Machine Learning
Machine Learning (ML) is a branch of Artificial Intelligence (AI) that enables machines (computers) to learn from data and improve performance without being explicitly programmed.
Example:
-
Email spam filters learn from past emails.
-
Recommendation systems suggest movies based on user behavior.
👉 Key Difference
| Human Learning | Machine Learning |
|---|---|
| Uses brain | Uses algorithms |
| Learns from experience | Learns from data |
| Emotional & logical | Mathematical & statistical |
1.2 Types of Machine Learning
Machine Learning can be classified into different types based on how the machine learns from data and the type of feedback it receives.
Broadly, Machine Learning is divided into three major types:
-
Supervised Machine Learning
-
Unsupervised Machine Learning
-
Reinforcement Machine Learning
Each type serves a different purpose and is used in different real-world situations.
1.2.1 Supervised Machine Learning
Definition
Supervised Machine Learning is a learning technique in which the machine is trained using a labeled dataset, meaning that both input data and the correct output are already known.
The machine learns by comparing its predicted output with the actual output and correcting errors during training.
How Supervised Learning Works (Step-by-Step)
-
A dataset is collected with input features and target labels
-
The data is divided into training data and testing data
-
The model learns the relationship between inputs and outputs
-
The trained model is tested using unseen data
-
Accuracy and performance are evaluated
Simple Example
Suppose we want to predict whether an email is Spam or Not Spam.
| Email Content | Label |
|---|---|
| Win a prize now | Spam |
| Meeting at 10 AM | Not Spam |
Since the output label is already provided, this is supervised learning.
Real-World Applications
-
Email spam filtering
-
Student marks prediction
-
Credit score evaluation
-
Disease diagnosis
-
House price prediction
Types of Supervised Learning
Supervised learning is further divided into:
-
Classification
-
Regression
Advantages
-
High accuracy
-
Easy to evaluate performance
-
Clear learning objective
Disadvantages
-
Requires large labeled datasets
-
Labeling data is time-consuming
-
Not suitable when output is unknown
1.2.2 Unsupervised Machine Learning
Definition
Unsupervised Machine Learning is a learning method where the machine is trained using unlabeled data, meaning no predefined output is provided.
The system discovers hidden patterns, relationships, or structures in the data by itself.
How Unsupervised Learning Works
-
Only input data is given to the system
-
The algorithm analyzes similarities and differences
-
Data is grouped or associated automatically
-
Patterns are extracted without human guidance
Simple Example
Customer purchase data without categories:
| Customer | Items Purchased |
|---|---|
| A | Milk, Bread |
| B | Mobile, Charger |
| C | Milk, Butter |
The algorithm groups customers based on similarity without labels.
Real-World Applications
-
Customer segmentation
-
Market basket analysis
-
Image grouping
-
Document clustering
-
Fraud detection
Types of Unsupervised Learning
-
Clustering
-
Association
Advantages
-
No labeled data required
-
Useful for discovering hidden patterns
-
Suitable for large datasets
Disadvantages
-
Results are harder to interpret
-
No direct accuracy measurement
-
May produce unexpected groupings
1.2.3 Reinforcement Machine Learning
Definition
Reinforcement Learning is a type of Machine Learning where an agent learns by interacting with an environment and improves its behavior using rewards and penalties.
The goal is to maximize cumulative reward over time.
Key Components
-
Agent: The learner or decision maker
-
Environment: The world the agent interacts with
-
Action: What the agent does
-
Reward: Feedback from the environment
-
Policy: Strategy followed by the agent
How Reinforcement Learning Works
-
Agent performs an action
-
Environment responds with a reward or penalty
-
Agent updates its strategy
-
Process repeats until optimal behavior is learned
Simple Example
Teaching a dog tricks:
-
Correct action → Reward
-
Wrong action → No reward
Similarly, machines learn from feedback.
Real-World Applications
-
Game AI (Chess, Ludo, PUBG bots)
-
Robotics
-
Self-driving cars
-
Recommendation systems
-
Traffic signal optimization
Advantages
-
Learns optimal strategies
-
No labeled data required
-
Suitable for complex decision problems
Disadvantages
-
Requires many training trials
-
Computationally expensive
-
Difficult to implement
1.2.4 Comparison of Machine Learning Types
| Feature | Supervised | Unsupervised | Reinforcement |
|---|---|---|---|
| Data Type | Labeled | Unlabeled | Feedback-based |
| Output Known | Yes | No | Reward-based |
| Main Goal | Prediction | Pattern discovery | Decision optimization |
| Example | Marks prediction | Customer grouping | Game playing AI |
1.2.5 Summary
-
Supervised Learning is used when output labels are available
-
Unsupervised Learning is used when structure in data must be discovered
-
Reinforcement Learning is used when decisions are learned through rewards
1.3 Supervised Machine Learning
1.3.1 Introduction to Supervised Machine Learning
Supervised Machine Learning is one of the most widely used and easiest-to-understand types of machine learning.
In this learning approach, a machine is trained using a dataset in which the correct answers are already known.
The term “supervised” means that the learning process is guided, similar to how a teacher guides students by giving questions along with correct answers.
1.3.2 Definition of Supervised Machine Learning
Supervised Machine Learning is a learning technique in which a machine learning model is trained using labeled data, where each input is paired with a known output, and the model learns to predict the output for new, unseen data.
In simple words:
Input + Correct Output → Learning → Prediction
1.3.3 Concept of Labeled Data
What is Labeled Data?
Labeled data is data where the input values and corresponding output values are already provided.
Example of Labeled Dataset
| Study Hours | Marks |
|---|---|
| 2 | 35 |
| 4 | 55 |
| 6 | 70 |
| 8 | 85 |
-
Study Hours → Input (Feature)
-
Marks → Output (Label)
The model learns the relationship between study hours and marks.
1.3.4 How Supervised Machine Learning Works
The working of supervised machine learning can be explained step by step as follows:
Step 1: Data Collection
Relevant data is collected from sources such as:
-
Databases
-
CSV files
-
Sensors
-
Surveys
Step 2: Data Preparation
The collected data is cleaned by:
-
Removing missing values
-
Removing duplicate entries
-
Handling incorrect data
Step 3: Splitting the Dataset
The dataset is divided into:
-
Training Data (usually 70–80%)
-
Testing Data (usually 20–30%)
Step 4: Model Training
The algorithm learns patterns from the training data by adjusting its internal parameters.
Step 5: Prediction
The trained model predicts output for new, unseen data.
Step 6: Evaluation
The model’s performance is evaluated using:
-
Accuracy
-
Confusion matrix
-
Error rate
1.3.5 Diagram Explanation (in Words)
-
Input data is given to the model
-
The algorithm processes the data
-
Output is generated
-
Output is compared with actual result
-
Error is minimized through learning
This loop continues until the model becomes accurate.
1.3.6 Types of Supervised Machine Learning
Supervised machine learning is mainly divided into two types:
1. Classification
-
Output is categorical
-
Example outputs: Yes/No, Pass/Fail, Spam/Not Spam
2. Regression
-
Output is continuous numeric
-
Example outputs: Salary, Temperature, House Price
1.3.7 Classification in Supervised Learning
Definition
Classification is a supervised learning technique used to predict class labels for given input data.
Examples
-
Email spam detection
-
Disease diagnosis (Positive/Negative)
-
Student result (Pass/Fail)
Popular Classification Algorithms
-
Logistic Regression
-
Decision Tree
-
K-Nearest Neighbour (K-NN)
-
Support Vector Machine (SVM)
1.3.8 Regression in Supervised Learning
Definition
Regression is a supervised learning technique used to predict continuous numerical values.
Examples
-
Salary prediction
-
Sales forecasting
-
Weather prediction
Popular Regression Algorithms
-
Linear Regression
-
Polynomial Regression
-
Ridge Regression
-
Lasso Regression
1.3.9 Real-World Applications of Supervised Machine Learning
Supervised machine learning is widely used in many fields:
Education
-
Predicting student performance
-
Automatic grading systems
Healthcare
-
Disease detection
-
Medical image analysis
Finance
-
Loan approval
-
Credit scoring
Business
-
Sales prediction
-
Customer churn prediction
Technology
-
Face recognition
-
Speech recognition
1.3.10 Advantages of Supervised Machine Learning
-
High prediction accuracy
-
Clear learning objective
-
Easy to evaluate results
-
Suitable for real-world prediction problems
1.3.11 Disadvantages of Supervised Machine Learning
-
Requires large labeled datasets
-
Data labeling is expensive and time-consuming
-
Not suitable when output is unknown
-
Overfitting may occur if not handled properly
1.3.12 When to Use Supervised Learning
Supervised learning should be used when:
-
Output labels are available
-
High accuracy is required
-
Historical data exists
-
Prediction is the main goal
1.4 Unsupervised Machine Learning
Definition
Unsupervised Learning uses unlabeled data, where the machine finds patterns on its own.
Example
-
Grouping customers based on buying behavior
-
Organizing images by similarity
1.5 Reinforcement Learning
Definition
Reinforcement Learning is based on reward and punishment.
The system learns by trial and error.
Example
-
Game-playing AI (Chess, Ludo)
-
Robot learning to walk
1.6 Applications of Machine Learning
-
Healthcare (disease prediction)
-
Banking (fraud detection)
-
Education (student performance analysis)
-
Agriculture (crop yield prediction)
-
E-commerce (recommendation systems)
-
Self-driving cars
1.7 Tools and Technologies for Machine Learning
-
Programming Languages: Python, R
-
Libraries: NumPy, Pandas, Matplotlib, Scikit-learn
-
Platforms: Google Colab, Jupyter Notebook
-
Databases: MySQL, MongoDB
Comments
Post a Comment