1) What is Machine Learning? Explain different types of ML with an example.
Machine Learning - Machine Learning is a subset of Artificial Intelligence (AI) that enables machines to
learn patterns from data and make decisions with minimal human intervention.
1. Supervised Learning
Definition:
The model is trained on a labeled dataset, which means each input comes with a corresponding output
(target value).
Goal:
To learn a function that maps inputs to correct outputs, so it can predict labels for new data.
Examples:
• Spam detection: Classify emails as "spam" or "not spam".
• House price prediction: Predict house prices based on features like size, location, etc.
Algorithms:
• Linear Regression
• Logistic Regression
• Decision Trees
• Support Vector Machines (SVM)
• Neural Networks
2. Unsupervised Learning
Definition:
The model is trained on unlabeled data — it must discover hidden patterns or structure without explicit
instructions.
Goal:
To explore data and find structure or grouping (like clusters or associations).
Examples:
• Customer segmentation: Group customers based on buying behavior.
• Anomaly detection: Detect unusual patterns (e.g., fraud detection).
Algorithms:
• K-Means Clustering
• Hierarchical Clustering
• Principal Component Analysis (PCA)
• Autoencoders
3. Reinforcement Learning
Definition:
An agent learns by interacting with an environment and receiving rewards or penalties for actions
taken.
Goal:
To learn a policy that maximizes cumulative reward over time.
Examples:
• Game playing: AI learning to play chess or Go.
• Robotics: A robot learning to walk or grasp objects.
Key Concepts:
• Agent, Environment
• State, Action, Reward
• Policy, Value function
Algorithms:
• Q-Learning
• Deep Q-Networks (DQN)
• Policy Gradient methods
Difference Between Informed and Uninformed Search Strategies
Aspect Uninformed Search (Blind) Informed Search (Heuristic)
Search that has no extra information Search that uses heuristic
Definition about states beyond the problem knowledge to guide the search
definition
Knowledge Only uses information from the initial Uses a heuristic function
Used state and goal test (estimated cost to goal)
Search Searches intelligently toward
Explores the search space blindly the goal
Direction
More efficient and faster due
Efficiency Typically slower and less efficient to guided search
Examples - Breadth-First Search (BFS)
• Depth-First Search (DFS)
• Uniform Cost Search (UCS) | - A* Search
• Greedy Best-First Search
• Beam Search |
| Completeness | May or may not be complete depending on method | Often complete if heuristic is
admissible |
| Optimality | Only some methods are optimal (e.g., UCS, BFS) | A* is optimal if the heuristic is
admissible and consistent |
Example: Pathfinding Problem
Imagine a robot trying to find the shortest path from Start (S) to Goal (G) in a maze.
Uninformed Search (e.g., BFS):
• Explores all nodes level-by-level.
• May expand many unnecessary nodes before reaching the goal.
• Does not know which direction is better.
Informed Search (e.g., A*):
• Uses a heuristic like straight-line distance to guide the search.
• Prioritizes nodes that seem closer to the goal.
• Reaches the goal with fewer expansions and less time.
Why Informed Search is More Efficient
1. Guided Exploration: Heuristics help the algorithm focus on promising paths instead of searching blindly.
2. Fewer Node Expansions: Reduces the number of unnecessary states explored.
3. Faster Convergence: Reaches the goal more quickly due to prioritized node selection.
4. Resource Saving: Saves both time and memory compared to uninformed approaches.
Applications of Machine Learning (ML)
Machine Learning is widely used across various industries due to its ability to learn from data and make
predictions or decisions without being explicitly programmed. Here are some key applications:
1. Email Filtering (Spam Detection)
• Use: Automatically classifies emails as spam or not spam.
• Technique: Supervised learning using text classification.
2. Recommendation Systems
• Use: Suggests movies (Netflix), products (Amazon), or music (Spotify).
• Technique: Collaborative filtering, matrix factorization.
3. Fraud Detection
• Use: Detects unusual behavior in banking transactions.
• Technique: Anomaly detection, supervised classification.
4. Healthcare and Diagnostics
• Use: Predicts diseases, analyzes X-rays, MRI scans, or recommends treatments.
• Technique: Deep learning (CNNs), classification.
5. Self-Driving Cars
• Use: Detects pedestrians, signs, and other vehicles to drive autonomously.
• Technique: Reinforcement learning, computer vision.
6. Natural Language Processing (NLP)
• Use: Language translation, chatbots, sentiment analysis, speech recognition.
• Technique: Sequence models, transformers (like GPT).
7. Stock Market Prediction
• Use: Predicts future stock prices or market trends.
• Technique: Time-series forecasting, regression models.
8. Industrial Automation & Predictive Maintenance
• Use: Predicts machine failures before they happen.
• Technique: Regression, time-series analysis.
9. Surveillance and Security
• Use: Face recognition, activity detection in video feeds.
• Technique: Computer vision, facial recognition algorithms.
10. E-Commerce Personalization
• Use: Shows personalized ads, adjusts product rankings based on user behavior.
• Technique: User behavior analysis, unsupervised learning.
Conclusion:
Machine Learning is powering real-world applications in finance, healthcare, transportation,
entertainment, and more, making systems smarter and more efficient.
function ProblemSolvingAgent(percept):
static: state, goal, problem, solution ← null
state ← UpdateState(state, percept)
if solution is empty then
goal ← FormulateGoal()
problem ← FormulateProblem(state, goal)
solution ← Search(problem)
action ← FirstAction(solution)
solution ← RemainingActions(solution)
return action