MACHINE LEARNING
Dr. P V Siva Teja
Assistant Professor
Textbooks:
Reference Books:
1. “Machine Learning”, Tom M. Mitchell, McGraw-Hill Publication, 2017
2. “Machine Learning in Action”,Peter Harrington, DreamTech
3. Applied Machine Learning, 2nd edition, 2021, M. Gopal
4. “Introduction to Data Mining”, Pang-Ning Tan, Michel Stenbach, Vipin Kumar,7thEdition, 2019.
Syllabus
UNIT-1: Introduction to Machine Learning
Evolution of Machine Learning, Paradigms for ML, Learning by Rote, Learning by Induction, Reinforcement Learning, Types of Data, Matching, Stages in Machine Learning, Data Acquisition, Feature Engineering, Data Representation, Model Selection, Model Learning, Model Evaluation, Model Prediction, Search and Learning, Data Sets.
UNIT-2: Nearest Neighbor-Based Models
Introduction to Proximity Measures, Distance Measures, Non-Metric Similarity Functions, Proximity Between Binary Patterns, Different Classification Algorithms Based on the Distance Measures, K-Nearest Neighbor Classifier, Radius Distance Nearest Neighbor Algorithm, KNN Regression, Performance of Classifiers, Performance of Regression Algorithms.
UNIT-3: Models Based on Decision Trees
Decision Trees for Classification, Impurity Measures, Properties, Regression Based on Decision Trees, Bias–Variance Trade-off, Random Forests for Classification and Regression. The Bayes Classifier: Introduction to the Bayes Classifier, Bayes’ Rule and Inference, The Bayes Classifier and its Optimality, Multi-Class Classification | Class Conditional Independence and Naive Bayes Classifier (NBC).
Syllabus
UNIT-4: Linear Discriminants for Machine Learning
Introduction to Linear Discriminants, Linear Discriminants for Classification, Perceptron Classifier, Perceptron Learning Algorithm, Support Vector Machines, Linearly Non-Separable Case, Non linear SVM, Kernel Trick, Logistic Regression, Linear Regression, Multi-Layer Perceptrons (MLPs), Backpropagation for Training an MLP.
UNIT-5: Clustering
Introduction to Clustering, Partitioning of Data, Matrix Factorization | Clustering of Patterns, Divisive Clustering, Agglomerative Clustering, Partitional Clustering, K-Means Clustering, Soft Partitioning, Soft Clustering, Fuzzy C-Means Clustering, Rough Clustering, Rough K-Means Clustering Algorithm, Expectation Maximization-Based Clustering, Spectral Clustering.
Course Outcome’s
CO1 | Identify the various fundamental concepts of Machine Learning in real time scenarios |
CO2 | Apply various Nearest Neighbor-Based models for classification and regression |
CO3 | Develop the models based on decision trees and Bayes classifier concepts |
CO4 | Make use of various Linear and Non-Linear discriminant Techniques for classification and regression. |
CO5 | Build the Clustering Techniques and Dimensionality Reduction Models. |
Machine Learning
Definition: It is the process of teaching a model to learn from data, instead of being explicitly programmed with rules
Main Tasks:
Classification: Is this a cat or a dog?
Regression: How much will this house cost?
Experience + Data = Getting Smarter
The more data the machine sees, the better it gets at its job—just like a student studying for a test!
Evolution of Machine Learning
Machine learning (ML) is the process of learning a model that can be used to make predictions based on data.
Prediction involves either classification (assigning a data item to a category or class) or regression (associating the data item with a number).
ML is considered an important and state-of-the-art topic, which gained prominence due to faster processing speeds, greater storage availability, and large datasets for experimentation.
The history of ML :-
While ML might sound like new technology, it's been around for decades. The ML we know today has its roots as far back as the 1940’s.
1940's :-
In 1943, Warren McCulloch & Walter Pitts created the first neural network. This allowed computers to communicate with each other without human interaction.
1950's :-
Alan Turing created the Turing Test to determine whether machines can behave like humans. Researchers still use the Turing Test today to see if humans can tell the difference between human-generated & machine-generated outputs.
1960's :-
Thomas Cover & Peter Hart published the K-Nearest Neighbours algorithm, one of the first ML algorithms that could identify patterns from a large amount of data.
1970's :-
Paul Werbos wrote a dissertation in 1974 titled "The Roots of Backpropagation," which paved the way for backpropagation—a technology that allows neural networks to recognise patterns more accurately.
1980's :-
Explanation-Based Learning (EBL) made it possible for computers to analyze & train themselves on data, as well as disregard unimportant data. Artificial neural network NetTalk also learnt how to correctly pronounce English text.
1990's :-
In 1997, IBM stunned the world when its supercomputer Deep Blue defeated an expert human chess player. This showed the world that ML could match & even exceed human performance.
2000's :-
Torch (now known as PyTorch), a free software library, became the world's first large-scale ML platform. Computers also learnt how to "see" text & images with deep learning.
2010's :-
Google develops Google Brain, a deep neural network that automatically categorizes objects. Facebook, Amazon, & Microsoft also develop ML models.
2020's :-
In November 2022, OpenAI's ChatGPT took the world by storm. This technology made ML & AI accessible to everyday people, who use the technology for everything from generating job cover letters to writing emails.
2023 :-
OpenAI released GPT-4, a massive leap in reasoning that could process both images and text. This year also saw the "Open Source Summer," where Meta released Llama, allowing researchers worldwide to run powerful ML models on their own hardware.
2024 :-
The era of Multimodal AI arrived. Google released Gemini, and OpenAI launched GPT-4o, both capable of seeing, hearing, and talking in real-time with near-zero latency. AI also made massive strides in science; AlphaFold 3 was released, predicting the structure of all life’s molecules (DNA, RNA, and proteins) with high accuracy.
2025 :-
The focus shifted to Agentic AI—systems like DeepSeek R1 and OpenAI o3 that don't just chat, but "think" through complex problems and use tools to complete multi-step tasks. Small Language Models (SLMs) also became popular, allowing high-performance AI to run locally on smartphones and laptops without an internet connection.
Machine learning is closely related to pattern recognition and data mining. Machine learning specifically involves learning from examples (supervised learning like classification and regression) and learning from observations (unsupervised learning like clustering). These tasks deal with the typical problems of a pattern recognition (PR) system. Conventional AI, on the other hand, deals with logic, rule-based systems, and expert systems, often utilizing languages like Lisp or Prolog.
In ML, we primarily deal with vectors and vector spaces, and these topics are best understood through linear algebra. The data input to an ML system is typically viewed as a data matrix A, which is of size n * l,
where n is the number of data items, and l is the dimension of each vector.
Linear algebra is useful for analyzing the weights associated with the edges in a neural network. Crucially, matrix multiplication and eigen analysis are important for initializing and updating the weights of the neural network, and clustering itself can be viewed as a process of data matrix factorization.
Paradigms for Machine Learning
Supervised Machine Learning
Applications of Supervised ML
Types of Supervised ML
Classification
Classification Algorithms
Regression
Regression Algorithms
Advantages
Disadvantages
Unsupervised Machine Learning
Types of Unsupervised Learning:
�Advantages:
�Disadvantages:
�Applications:
Semi-Supervised Learning
Advantages :-
Disadvantages :-
Reinforcement Learning
Markov Decision Process (MDP)
Types of Reinforcement Learning
Advantages
Disadvantages
Applications
Knowledge Acquisition & Problem Solving in Machine Learning
In Machine Learning, there are different approaches to Knowledge Acquisition & Problem Solving. They are:
Rote Learning
Advantages of Rote Learning
Explanation next slide
1. Quick Recall
2. Enhanced Mental Discipline
3. Builds Memory Muscle
4. Precision
5. Simple to Implement
Disadvantages of Rote Learning
1. No higher-order skills:
One major disadvantage of rote learning is that it promotes a superficial approach to education. Students tend to memorize information solely to pass exams rather than achieve a meaningful understanding of the subject matter. This learning style discourages analysis, synthesis, & evaluation—all of which are higher-order thinking skills essential for applying knowledge in practical scenarios.
2. Limits problem-solving skills:
In today's world, solving complex problems matters more than ever. Rote learning falls short in fostering creative thinking or adapting to unfamiliar scenarios, leaving students ill-prepared for real-world hurdles.
3. Tedious & Uninspiring:
Rote learning, instead of encouraging a passion for learning & curiosity, can make education tedious & uninspiring. This lack of engagement might result in less knowledge retention over time.
4. Overlooks individual learning style:
Rote learning is a one-size-fits-all approach. It fails to accommodate different students with unique ways of learning & assimilating information.
5. Limited ability to generalize to new situations:
Lacks the capacity for intelligent decision-making & is not adaptable.
Inductive Learning
Need for Inductive Learning
Inductive Learning
Learning by Inductive
In ML, different approaches to knowledge acquisition & problem solving are:
It is an iterative & inductive ML algorithm that is used to generate a set of classification rules, which produces rules of the form "IF-THEN", for a set of examples; producing rules at each iteration & appending to the set of rules.
Example
Basic Requirements to Apply Inductive Learning Algorithm
Example No. | Place Type | Weather | Location | Decision |
1. | hilly | winter | Kullu | Yes |
2. | mountain | windy | Mumbai | No |
3. | mountain | windy | Shimla | Yes |
4. | beach | warm | - | No |
5. | beach | windy | Goa | Yes |
6. | beach | windy | Goa | No |
7. | beach | warm | Mumbai | Yes |
Example
Subset-1
S.No | Place Type | Weather | Location | Decision |
1 | hilly | winter | Kullu | Yes |
2 | mountain | windy | Shimla | Yes |
3 | beach | warm | Goa | Yes |
4 | beach | warm | Shimla | Yes |
Subset-2
S.No | Place Type | Weather | Location | Decision |
5 | mountain | windy | Mumbai | No |
6 | beach | windy | Mumbai | No |
7 | beach | windy | Goa | No |
General Rules
Iteration-1
Action: Rows 3 & 4 and column "weather" are selected; rows 3 & 4 are marked and the rule is added to R.
Rule: IF weather is warm THEN a decision is yes.
Iteration-2
Action: Row 1 and "place type" column are selected; row 1 is marked and the rule is added to R.
Rule: IF place type is hilly THEN decision is yes.
Iteration-3
Action: Row 2 and column "location" are selected.
Rule: IF location is Shimla THEN the decision is yes.
Iteration-4
Action: Rows 5 & 6 and column "location" are selected.
Rule: IF location is Mumbai THEN the decision is no.
Iteration-5
Action: Row 7 and columns "place type" & "weather" are selected.
Rule: IF place type is beach AND weather is windy THEN the decision is no.
Real-world Examples:
Advantages:
Disadvantages: a) Overfitting b) Data Dependency c) Potential for Error d) Time Consuming
Reinforcement Learning
�
Key Components of Reinforcement Learning
How it works:
The agent takes actions in environment, & based on those actions, the environment transitions to a new state and provide a reward. The agent’s goal is to learn a policy that maximizes the cumulative reward over time.
This learning process involves exploring different actions, observing their consequences & adjusting the policy accordingly.
Types of Reinforcement in RL
There are two types of RL:
1. Positive RL
It is defined as when an event, occurs due to a particular behaviour, increase the strength & the frequency of behaviour. In other words, it has a positive effect on behaviour.
2. Negative RL
It is defined as strengthening of behaviour because a negative condition is stopped or avoided.
�
Example:
We have an agent & a reward, with many hurdles in btw (between). The agent is supposed to find the best possible path to reach the reward.
Applications of RL
Advantages:
Disadvantages:
Dataset
Roll Number | Name | Gender | Age |
238T1A301 | Hema | F | 19 |
238T1A302 | Madhu | F | 18 |
238T1A303 | Nasrin | F | 21 |
Types of Data
Data can be broadly divided into the following two types:
1. Qualitative Data
i) Nominal data
ii) Ordinal Data
|
2. Quantitative Data
�
Interval Data
Ratio Data
Matching
1. String Matching
a) Fuzzy Matching: This approach allows for approximate string matching, handling variations like misspellings, typos, or different formatting.
b) Exact Matching: Identifies identical strings.
c) String Searching: Algorithms like Knuth-Morris-Pratt (KMP), Boyer-Moore & Aho-Corasick are used for efficiently finding patterns within larger text.
�2. Image Matching
a) Feature-Based Matching: Algorithms like SIFT, SURF, ORB, AKAZE, BRISK & FREAK extract keypoints & descriptors from images to find corresponding features.
b) Deep Learning Approaches: Convolutional Neural Networks (CNN) can be trained to learn complex image representations for matching.
3. Data Matching
a. Probabilistic Matching: Uses statistical models to assess likelihood of two records being a match, considering various attributes & their probabilities.
b. ML-based Matching: Algorithms learn to identify matching patterns from data, for accuracy & adaptability over time.
4. Other Matching Algorithms
Applications
�Advantages
Stages of Machine Learning
1. Data Collection
2. Data Preprocessing
3: Choosing the Right Model
4. Training the Model
5: Evaluating the Model
�6: Hyperparameter Tuning & Optimization
Step-7: Predictions & Deployment
Data Acquisition
Data Acquisition in Machine Learning
What Methods can be used to acquire data?
When might someone use data acquisition?
Sources of Data:
Data Acquisition Process
It contains several steps to process the data. They are:
1. Identifying Data Sources:
The first step in this process is identifying the sources from which data will be collected. These sources could be physical devices (like sensors), digital platforms (like social media) or existing databases.
2. Data Collection:
Next, collect data after identifying the sources. One can use automatic or manual systems to achieve this task. In many cases, data collection involves capturing real-time data from sensors or scraping data from websites.
3. Data Preprocessing:
Raw data is often messy & may contain errors or inconsistencies.
Data preprocessing involves in:
4. Data Storage:
After preprocessing the data, it should be in a secure location. Depending on the volume of data, this could be a database, a data warehouse, or cloud storage. Proper data storage is essential to maintaining data integrity & facilitating easy access for analysis.
5. Data Validation:
Before analyzing the data, one must validate it to ensure accuracy & completeness. Data validation checks for any inconsistencies, missing values, or errors that may have been introduced during the collection or preprocessing stages.
6. Data Integration:
In many cases, integrating data from multiple resources is necessary to create a comprehensive dataset. Data integration involves combining data from different sources & ensuring consistency across the dataset.
7. Data Analysis:
After acquiring, preprocessing & validating the data, it is ready for data analysis. This step involves using statistical methods or ML algorithms to extract insights from data.
Data Acquisition Tools
There are various tools & technologies available to facilitate the data acquisition process. They are:
Data Acquisition Applications
It is used in wide range applications across different industries. They are:
a) Healthcare Monitoring
b) Environmental Monitoring
c) Manufacturing Process Control
d) Financial Market Analysis
e) Scientific Research
Importance of Data Acquisition
�Advantages
Disadvantages
Feature Engineering
It involves extracting features (columns) from raw data to solve specific domain-specific problems using machine learning.
Feature:
Feature Engineering has two major parts:-
1. Feature Transformation:
It transforms the data (structured or unstructured) into a new set of features which can represent the underlying problem which ML is trying to solve. There are two variants of feature transformation or feature discovery:
Feature Construction:
Feature Extraction: It is the process of extracting or creating a new set of features from the original set of features using some functional mapping.
2. Feature Subset Selection / Selection:
Steps in Feature Engineering
Feature Engineering can vary depending on the specific problem, but the general steps are:
1. Data Cleaning
Identify and correct errors or inconsistencies in the dataset to ensure data quality and reliability.
2. Data Transformation
Transforms raw data into a format suitable for modeling, scaling, normalization, and encoding.
3. Feature Extraction
Create new features by combining or deriving information from existing ones to provide more meaningful input to the model.
4. Feature Selection
Choose the most relevant features for the model using techniques like correlation analysis, mutual information, and stepwise regression.
Data Representation
�Data Representation in ML:
�Types of Data Representation:
1. Tabular Representation
Data is arranged in a table format where rows represent instances (samples) and columns represent features (attributes or variables).
Example:
Age | Income | Education | Purchased |
25 | 50,000 | Bachelor's | Yes |
45 | 70,000 | Master's | No |
Usage: Using this format is widely used in structured data scenarios, such as business or customer records.
2. Text Representation
Text data, such as sentences or document, need to be transformed into numerical format for ML algorithms.
Example: (BOW)
Usage: This representation is common in natural processing (NLP) tasks too like text classification, sentiment analysis, & Machine Translation.
3. Image Representation
Images are represented as multi-dimensional arrays or pixel values.
Grayscale Image
Represented as 2D matrices where each element corresponds to the intensity of a pixel.
Color Images
Represented as 3D matrices, where each pixel has values for Red, Green & Blue (RGB channels).
Usage
This is common in Computer Vision tasks such as:
4. Time Series Representation (Reinforcement Learning)
Time series data captures values collected or recorded at successive time intervals. It is represented as sequences, where time is a key component.
Example
Usage: This format is used in tasks like forecasting, anomaly detection, or sequence prediction where time plays a crucial role.
5. Graph Representation
Data is represented as a graph structure. Entities are nodes and relationships between entities are edges. It can be directed or undirected, weighted or unweighted.
Usage: Common in recommendation systems, social network analysis, and biological data analysis (e.g., Protein Interaction networks).
Model Selection
Model Evaluation
�Why Evaluation necessary for a Successive model?
Evaluation metrics
There are different metrics for the tasks of classification, regression, ranking, clustering, topic modelling etc. Some of the metrics are as follows:
Classification Metrics
Model Prediction:-
There are 7 types of modeling techniques listed:
Search and Learning
Search in ML
There are different types:
1. Search Algorithms within AI
Traditional search algorithms like Breadth-First Search (BFS) or Depth-First Search (DFS) are fundamental to AI and can be used in conjunction with ML.
For instance, in Reinforcement Learning, an agent might "search" for optimal actions within a given state space to maximize rewards.
2. Hyperparameter Optimization
ML models often have hyperparameters that are not learned from data but need to be set before training.
"Searching" for the best combination of these hyperparameters (e.g., Grid Search or Random Search) is crucial for model performance.
3. Information Retrieval & Semantic Search
ML plays a significant role in improving search engines and information retrieval systems.
Techniques like Vector Search, Neural Search, and NLP powered by ML models enhance the relevance and accuracy of search results by understanding the meaning and context of queries.
4. Feature Selection
In some cases, "search" can refer to the process of finding the most relevant features from a larger set of variables available in data to improve model performance and reduce complexity.
5. Interconnection
Search and learning often complement each other in ML applications. Learning can enable more effective search (e.g., a learned model improving search relevance) and search techniques can be used to optimize the learning process (e.g., hyperparameter search).
Learning in ML
Learning refers to the process by which a Machine Learning (ML) model acquires the ability to perform a specific task by extracting patterns and insights from data. This process typically involves:
1. Data Input
Providing the model with a dataset which can include:
2. Algorithm Applications
Employing an ML algorithm like NN (Neural Networks), DT (Decision Trees), and SVM (Support Vector Machines) to process the data and identify relationships or structures within it.
3. Model Training
Adjusting the model's internal parameters based on data and the algorithm's objective. Often involving optimization techniques to minimize errors or maximize rewards.
4. Generalization
The goal of learning is for the model to generalize, meaning it can accurately make predictions or decisions on new, unseen data, not just the data it was trained on.
Machine Learning Datasets
Types of ML Datasets:
There are three different ways to categorize the dataset:
How to Split Dataset Effectively
Splitting your ML datasets into these three subsets is crucial for accurate model evaluation:
Sources to find ML Datasets
1. Public Datasets
2. Generated Data (Synthetic Data)
3. Government & Open Data
4. Corporate / Domain-Specific Datasets
5. Paid Services
Top Resources of ML Dataset