1 of 83

MACHINE LEARNING

Dr. P V Siva Teja

Assistant Professor

2 of 83

Textbooks:

  1. “Machine Learning Theory and Practice”, M N Murthy, V S Ananthanarayana,Universities Press (India), 2024

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.

3 of 83

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).

4 of 83

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.

5 of 83

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.

6 of 83

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!

7 of 83

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.

8 of 83

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.

9 of 83

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.

10 of 83

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.

11 of 83

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.

12 of 83

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.

13 of 83

Paradigms for Machine Learning

14 of 83

Supervised Machine Learning

  • It is based on supervision.
  • It trains the machines using the labelled dataset, and based on training, the machine predicts output.
  • The labelled data specifies that some of the inputs are already mapped to output.
  • Train the machine with the input and corresponding output, and then the machine will predict the o/p (output) using test dataset.

15 of 83

Applications of Supervised ML

  • Fraud Detection
  • Risk Assessment
  • Spam Filtering

Types of Supervised ML

  1. Classification
  2. Regression

Classification

  • Classification algorithms are used to solve the classification in which the output variable is Categorical.
  • Such as "Yes" or "No", Male or Female, Red or Blue etc.
  • The classification algorithms predict the categories present in the dataset.

Classification Algorithms

  • Random Forest Algorithm
  • Decision Tree Algorithm
  • Logistic Regression Algorithm
  • Support Vector Machine Algorithm

16 of 83

Regression

  • Regression algorithms are used to solve regression problems in which there is a linear relationship between input and output variables.
  • These are used to predict continuous output variables, such as market trends, weather prediction, and marks of a student.

Regression Algorithms

  • Simple Linear Regression Algorithm
  • Multivariate Regression Algorithm
  • Decision Tree Algorithm
  • Lasso Regression

Advantages

  • Since Supervised Learning works with labelled datasets, so we can have an exact idea about the class of objects.
  • Predicting the output based on prior experience.

Disadvantages

  • These algorithms are not able to solve complex problems/tasks.
  • It may predict the wrong output if the test data is different from the training data.

17 of 83

Unsupervised Machine Learning

  • In unsupervised ML, the machine is trained using the unlabeled dataset, & the machine predicts the output without any supervision.
  • The main aim of unsupervised learning algorithm is to group or categories the unsorted dataset according to the similarities, patterns & differences.
  • Machines are instructed to find hidden patterns from input dataset.

18 of 83

Types of Unsupervised Learning:

  • Clustering
  • Association analysis

Advantages:

  • These Algorithms can be used for complicated tasks compared to the supervised once because this algorithm works on the unlabelled dataset.
  • Unsupervised algorithms are preferable for various tasks as getting unlabelled data set is easier at compared to labelled dataset.

Disadvantages:

  • The input of unsupervised learning algorithm can be less accurate as the dataset not labelled.
  • The algorithms are not trained the exact output in prior.

Applications:

  • Network Analysis
  • Recommendation Systems
  • Anomaly detection
  • Similar value decomposition

19 of 83

Semi-Supervised Learning

  • To overcome the drawbacks of supervised learning algorithm & unsupervised learning algorithm, the concept of Semi-supervised learning is introduced.
  • It is the intermediate ground between supervised (with labelled training data) & unsupervised (with no labelled training data) algorithms.
  • Hence it uses the combination of labeled & unlabeled datasets during the training period.
  • Initially, similar data is clustered along with an unsupervised learning algorithm, & further, it helps to label the unlabeled data into labelled data.
  • It is because labelled data is comparatively more expensive than unlabeled data.

Advantages :-

  • It is simple & easy to understand the algorithm.
  • It is highly efficient.
  • It is used to solve the drawbacks of Supervised & unsupervised learning algorithms.

Disadvantages :-

  • Iterations results may not be stable.
  • We cannot apply these algorithm to network label data.
  • Accuracy is low.

20 of 83

Reinforcement Learning

  • Reinforcement Learning works on a feedback based process, learning from being rewarded for each good action and get punished by each bad action.
  • Agents (Robots)
  • Hence the goal of reinforcement learning is to maximize the rewards.

Markov Decision Process (MDP)

  • A reinforcement learning problem can be formalized using Markov Decision Process (MDP).
  • In MDP, the agent constantly interacts with the environment and performs actions; at each action, the environment responds and generates a New State.
  • In RL, there is no labelled data like supervised learning.

Types of Reinforcement Learning

  • Active Reinforcement Learning
  • Passive Reinforcement Learning

21 of 83

Advantages

  • It helps in solving complex real-world problems which are difficult to be solved by General Techniques.
  • The learning model of RL is similar to the learning of Human beings, hence most accurate results can be found.
  • Helps in achieving long term results.

Disadvantages

  • RL algorithms are not preferred for simple problems.
  • RL algorithms require huge data and computations.

Applications

  • Video Games
  • Resource management
  • Robotics
  • Text mining & etc.

22 of 83

Knowledge Acquisition & Problem Solving in Machine Learning

In Machine Learning, there are different approaches to Knowledge Acquisition & Problem Solving. They are:

  1. Rote Learning Involves memorizing data without understanding underlying principles.
  2. Inductive Learning It aims to discover general rules from specific examples.
  3. Deductive Learning Applies established rules to solve specific problems.
  4. Meaningful Learning The concept is understood by students (with understanding concepts).

23 of 83

Rote Learning

  • Rote Learning is the most basic form of learning where the system memorizes the data (or) patterns without any attempt to generalize or infer new knowledge.
  • It is a learning technique which focuses on memorization.
  • The major practice involved in learning by repetition, by which students commit information to memory in a highly structured way.

Advantages of Rote Learning

  • Quick Recall
  • Enhanced Mental Discipline
  • Builds Memory Muscle
  • Precision
  • Simple to Implement

Explanation next slide

24 of 83

1. Quick Recall

  • Rote learning helps recall basic facts fast.
  • In subjects like maths or language, memorizing tables or words lays a strong foundation of knowledge upon which complex ideas can be built.
  • This rapid recall can be particularly advantageous in test-taking situations where time is limited and quick access to information is essential.

2. Enhanced Mental Discipline

  • The repetitive nature of rote learning demands focus and perseverance.
  • By mastering the art of concentration, learners can apply these skills to tackle more challenging subjects effectively.

25 of 83

3. Builds Memory Muscle

  • Another advantage of rote learning is that it can help build strong memory muscles.
  • Just as muscles in the body become stronger through exercise, the brain's ability to remember improves with repeated use.
  • This can lead to improved cognitive function overall, which is beneficial not only in scholarly pursuits but also in everyday activities that require memorization.

4. Precision

  • For topics that require accurate recall of information, such as historical dates or specific processes, rote learning ensures precision.
  • This accuracy is vital in professions where there is a little margin for error, such as in the legal or medical fields.

5. Simple to Implement

  • Can be useful for tasks requiring quick lookups or storage of large datasets.

26 of 83

Disadvantages of Rote Learning

  1. No higher-order skills
  2. Limits problem-solving skills
  3. Tedious & uninspiring
  4. Overlooks individual learning style

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.

27 of 83

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.

28 of 83

Inductive Learning

Need for Inductive Learning

  • There are basically two methods for knowledge extraction:
    • Domain experts
    • Machine Learning
  • For every large amount of data, the domain experts are not useful & reliable.
  • So we move towards the ML approach for this work.

Inductive Learning

  • Also known as Deterministic Supervised Learning.
  • In the first input x, (the verified value) given to a function f, therefore the output is f(x).
  • Then we can give different set of inputs (raw i/p's) to the same function f, & verify the o/p f(x).
  • By using the o/ps we generate the rules.
  • It is also known as "Discovery Learning," where the learner discovers rules by observing examples.
  • With Inductive Learning, tasks are designed specifically to guide the learner & assist them in discovering a rule.

29 of 83

Learning by Inductive

In ML, different approaches to knowledge acquisition & problem solving are:

  1. Meaningful Learning : Concept is fully understood by students.
  2. Rote Learning : Memorizing data without understanding.
  3. Inductive Learning : It aims to discover general rules from specific examples.
  4. Deductive Learning : Applies established rules to solve specific problems.

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

  • Mango f(Mango) Sweet (e1)
  • Banana f(Banana) Sweet (e2)
  • Fruits f(Fruits) Sweet (General Rule)

30 of 83

Basic Requirements to Apply Inductive Learning Algorithm

  1. List the examples in the form of a table ‘T’ where each row corresponds to an example & each column contains an attribute value.
  2. Create a set of m training examples, each example composed of k attributes & a ‘class attribute’ with n possible decisions.
  3. Create a rule set, R, having the initial value false.
  4. Initially all rows in the table are unmarked.

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

31 of 83

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

32 of 83

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.

33 of 83

Real-world Examples:

  • Decision Trees
  • Naive Bayes classifier
  • Support Vector Machines (SVM)
  • k-Nearest Neighbors (kNN)

Advantages:

  1. Generalization
  2. Pattern discovery
  3. Flexibility
  4. Simplicity

Disadvantages: a) Overfitting b) Data Dependency c) Potential for Error d) Time Consuming

34 of 83

Reinforcement Learning

  • RL is a machine learning paradigm where an agent learns to make decisions in an environment to maximize a cumulative reward.
  • It’s a trial-and-error approach where the agent learns through interactions with the environment, receiving feedback in the form of rewards or penalties for its actions.

Key Components of Reinforcement Learning

  • Agent: The decision-making entity that interacts with the system.
  • Environment: The world or system in which the agent operates, providing feedback in response to the agent's actions.
  • State: The current situation or condition of the environment.
  • Action: A possible action or move or decision the agent can take.
  • Reward: Feedback from the environment indicating the desirability of the agent's action.

35 of 83

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.

  • RL is the training of machine learning models to make a sequence of decisions.
  • The agent gets either rewards or penalties for the actions it performs.
  • It’s goal is to maximize the reward.

36 of 83

Types of Reinforcement in RL

There are two types of RL:

  1. Positive RL
  2. Negative 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.

    • Fire - hurdles in path
    • Agent - Robot
    • Diamond - Reward

37 of 83

Applications of RL

  1. Robotics: RL is used to automate tasks in structured environments such as manufacturing, where robots learn to optimize movements & improve efficiency.
  2. Game Playing: Advanced RL algorithms have been used to develop strategies for complex games like chess, Go, and video games, outperforming human players in many instances.
  3. Industrial Control: RL helps in real-time adjustments & optimization of industrial operations, such as refining processes in the oil & gas industry.
  4. Personalized Training Systems: RL enables the customization of instructional content based on an individual's learning pattern, improving engagement & effectiveness.

Advantages:

  • Solving complex problems
  • Error Correction
  • Direct Interaction with environment
  • Handling Non-Deterministic Environments

Disadvantages:

  • Not suitable for simple problems
  • High Computational Requirements
  • Dependency of Reward fn
  • Difficulty in Debugging & Interpretation

38 of 83

39 of 83

Dataset

  • A dataset is a collection of related information or records.
  • The info may be on some entity or some subject area.

Roll Number

Name

Gender

Age

238T1A301

Hema

F

19

238T1A302

Madhu

F

18

238T1A303

Nasrin

F

21

  • Each Row – Record
  • Each Column – Attributes
  • Each row of a dataset is a record.
  • Each column of a dataset has multiple attributes, each of which gives info on a specific characteristic.
  • Attribute can also be termed as Roll No., Name, Gender, & Age, "feature", "variable", "dimension", or "field".
  • Each row has specific values for each of the four attributes or features.
  • Values of an attribute vary from record to record.

40 of 83

Types of Data

Data can be broadly divided into the following two types:

  1. Qualitative data
  2. Quantitative data

1. Qualitative Data

  • It provides information about the quality of an object or information which cannot be measured.
  • Example:
  • Quality of performance of students in terms of Good, Average & Poor falls under the category of Qualitative data.
  • Name or roll number of students that cannot be measured using some scale of measurement.
  • Qualitative data is also called Categorical data.
  • Qualitative is classified as two types:
    1. Nominal data
    2. Ordinal data

i) Nominal data

  • It has no numeric value, but a named value.
  • Nominal values cannot be quantified.
  • It is used for assigning named values to attributes.

41 of 83

  • Mathematical operations such as addition, subtraction, multiplication, etc. cannot be performed on nominal data.
  • Statistical functions such as mean, variance, etc. cannot be performed on nominal data.
  • A basic count is possible.
  • The mode is possible i.e., most frequently occurred value, can be identified for nominal data.

42 of 83

ii) Ordinal Data

  • Ordinal data is naturally ordered.
  • This means ordinal data assigns named values to attributes.
  • They can be arranged in a sequence of increasing or decreasing value.
  • Hence, the comparison is possible.
  • Like nominal data, basic counting is possible for ordinal data.
  • Hence, the mode and median can be identified.
  • But mean cannot be calculated.

43 of 83

2. Quantitative Data

  • It refers to information about the quantity of an object - hence it can be measured.
  • For example; if we consider the attribute ‘marks’, it can be measured using a scale of measurement.
  • Quantitative data is termed as numeric data.
  • It is classified into two types:-
    • Interval
    • Ratio

44 of 83

Interval Data

  • Interval Data is numeric data - Identify the order & difference between values.
  • For Interval data, mathematical operations such as addition & subtraction is possible.
  • For that reason, the Interval data, the Central Tendency can be measured by mean, median & mode.
  • Standard deviation can be calculated.
  • It does not have a true-zero value.
  • Ex: There is nothing called no temperature or 0 temperature.
  • Hence, only addition & subtraction applies for Interval data.
  • Ratio cannot be applied.

45 of 83

Ratio Data

  • It represents numeric data for which exact value can be measured.
  • Absolute zero is available for ratio data.
  • These variables can be added, subtracted, multiplied or divided.
  • The central tendency can be measured by mean, median or mode and also standard deviation.
  • Ex: Ratio Includes height, weight, age, salary etc.

46 of 83

Matching

  • The process of identifying & linking records that represent the same real-world entity across different datasets.
  • It can involve comparing data points based on similarity, either exactly or with some degree of tolerance (fuzzy matching).
  • ML algorithms are used to automate & improve the accuracy of these matching processes.
  • In ML, real-world no. of matching algorithms are released. They are:
  • String Matching
  • Image Matching
  • Data Matching
  • Other matching algorithms.

47 of 83

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.

  • Supervised Learning: Models are trained on labeled data (pairs of matching & non-matching records) to predict matches.
  • Unsupervised Learning: Algorithms like clustering can be used to group similar records together.
  • Fuzzy Matching: Similar to fuzzy string matching, this can be applied to various data types to handle inconsistencies & variations.

48 of 83

4. Other Matching Algorithms

  • kNN (K-Nearest Neighbors): Classifies data points based on the majority class of their nearest neighbours in a feature space.
  • Cosine Similarity: Measures the similarity between two vectors by calculating the cosine of the angle between them.

Applications

  • Customer Data Management: Linking customer records across different systems.
  • Product Data Management: Matching product listings in online marketplaces.
  • Fraud Detection: Identifying potentially fraudulent transactions by matching transaction data with known fraud patterns.
  • Recommendation Systems: Matching users with items they might be interested in.

Advantages

  • Increased Efficiency
  • Improved Accuracy
  • Scalability
  • Reduced Bias: diff btw predicted o/p & original o/p.

49 of 83

Stages of Machine Learning

  • ML is a subset of AI, which uses algorithm that learn from data to make prediction.
  • These predictions can be generated through supervised learning, where algorithm learn patterns from existing data, or unsupervised learning where they discover general pattern in data.
  • ML models can predict numerical values based on historical data, categorized events as true or false, & cluster data points based on commonalities.
  • ML lifecycle is a process that guides development & deployment of ML models in a structured way. It consists various steps. They are:
  • Data collection
  • Data preprocessing
  • Choosing right model
  • Training the model
  • Evaluating the model
  • Hyperparameter tuning & optimization
  • Predictions & deployment

50 of 83

1. Data Collection

  • The first step in the ML process is data collection. Data is the lifeblood of ML—the quality & quantity of data can directly impact a model's performance.
  • Data can be collected from various sources such as databases; text-files, images, audio files, or even scraped from web.
  • Once collected, the data needs to be prepared for ML. This process involves organizing the data in suitable format, such as CSV file or a database.
  • Ex: weather.csv, iris.csv

2. Data Preprocessing

  • It is a crucial step in the machine learning process. It involves:
  • Cleaning the data (removing duplicates, correcting errors)
  • Handling missing data (either by removing it or filling it in)
  • Normalizing the data (scaling the data to a standard format)
  • Preprocessing improves the quality of data & ensures that ML model can interpret it correctly. This step significantly improve the accuracy of model.

51 of 83

3: Choosing the Right Model

  • Once the data is prepared, the next step is to choose a ML model. There are many types of models to choose from, including linear regression, decision trees, KNN & neural networks. The choice of model depends on the nature of data & the problem trying to solve.
  • Factors to consider when choosing a model include:
  • The size & type of data
  • The complexity of problem
  • The computational resources available

4. Training the Model

  • After choosing a model & the prepared data, the next step is to train it. Training involves feeding the data into the model & allowing it to adjust its internal parameters to better predict the output.
  • During training, it’s important to avoid:
  • Overfitting: (where the model performs well on the training data but poorly on new data)
  • Underfitting: (where the model performs poorly on both the training data & new data)

52 of 83

5: Evaluating the Model

  • Once a model is trained, evaluating its performance on unseen data is essential for deployment. Model monitoring doesn’t stop at initial stage; it involves ongoing evaluation to detect model drift & maintaining model quality over time.
  • Continuous monitoring & retraining workflows help organizations ensure their models remain effective & reliable in production environments.
  • Common metrics for evaluating model performance include:
  • Accuracy (for classification problems)
  • Precision & Recall (for binary classification problems)
  • Mean Squared Error (for regression problems) (Note: These are under the Confusion Matrix)

6: Hyperparameter Tuning & Optimization

  • Beyond tuning for accuracy, hyperparameter optimization within an ML operation (MLOps) pipeline includes tools for automated hyperparameter searches, ensuring efficiency & reproducibility.

53 of 83

Step-7: Predictions & Deployment

  • Deploying a ML model involves integrating it into a production environment, where it can deliver real-time predictions or insights. MLOps has emerged as a standard practice to streamline this process.
  • It encompasses version control, monitoring & automated testing to ensure models are reproducible, reliable & robust. MLOps frameworks like MLFlow support these goals by providing seamless workflows for deployment, retraining & model rollback if issues arise.

54 of 83

Data Acquisition

55 of 83

Data Acquisition in Machine Learning

  • The process of collecting & storing data for Machine learning from variety of sources is known as data acquisition.
  • Once gathered or collected, the data will be stored, filtered, cleaned & analyzed in order to provide insights to the user.

What Methods can be used to acquire data?

  • Collecting new data – experiments, observations, survey.
  • Converting or transforming pre-existing data.
  • Sharing or exchanging data.
  • Purchasing data.

When might someone use data acquisition?

  • Optimize an already existing system.
  • Answer a question or solve a problem.

56 of 83

Sources of Data:

  • Real world Signals: Data acquisition systems (DAS or DAQ) convert physical phenomena (like temperature, pressure, voltage) into digital values that a computer can process.
  • Existing data Sources: Databases, APIs, IOT devices & online repositories are common sources of pre-existing data.
  • Generated data: In some cases, data may need to be generated through methods like surveys, experiments or simulations.
  • Web Scraping: Gathering data from websites using automated tools.
  • Crowdsourcing: Collecting data from a large group of people, often through online platforms.

57 of 83

Data Acquisition Process

It contains several steps to process the data. They are:

  1. Identifying Data Sources
  2. Data Collection
  3. Data Preprocessing
  4. Data Storage
  5. Data Validation
  6. Data Integration
  7. Data Analysis

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.

58 of 83

3. Data Preprocessing:

Raw data is often messy & may contain errors or inconsistencies.

Data preprocessing involves in:

  • Cleaning the data
  • Removing duplicates
  • Transforming it into a structured format
  • This step is crucial to ensure that the data is suitable for analysis.

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.

59 of 83

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.

60 of 83

Data Acquisition Tools

There are various tools & technologies available to facilitate the data acquisition process. They are:

  1. Labview
  2. MATLAB
  3. Apache NiFi
  4. AWS pipeline
  5. Web Scraping Tools
  6. Custom API’s

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

61 of 83

Importance of Data Acquisition

  • Model Training: ML models learn from the data they are trained on. High quality, representative data is essential for good model performance.
  • Model Evaluation: Data Acquisition is also crucial for testing & evaluating the performance of trained models on new, unseen data.
  • Feature Engineering: It provides the raw material for creating meaningful features that the model can use for prediction.
  • Addressing Bias: Careful data acquisition can help mitigate bias in models by ensuring diverse & representative data is used.
  • Efficiency: Automated data acquisition systems can improve efficiency & reduce the time & effort required to collect & prepare data.

Advantages

  • Reduced data redundancy.
  • Reduced updating errors & increased consistency.
  • Greater data integrity & independence from application programs.
  • Improved data access to users through use of host & query languages.
  • Improves data security.
  • Reduced data entry, storage & retrieval costs.

Disadvantages

  • Database systems are complex, difficult, and time consuming to design.
  • Substantial hardware & software start-up costs.
  • Damage to database affects virtually all application programs.

62 of 83

Feature Engineering

It involves extracting features (columns) from raw data to solve specific domain-specific problems using machine learning.

Feature:

  • It is an attribute of a dataset that is used in a ML process.
  • The attributes which are meaningful to a ML problem are to be called as features.
  • The features in a dataset are also called dimensions.
  • So a dataset having 'n' features is called an n-dimensional dataset.
  • The selection of a subset of features is an important subpart of ML.
  • Feature Engineering is the process of translating a dataset into features such that these features are able to represent the dataset more effectively & result in a better learning performance.
  • Feature Engineering is an important preprocessing step for ML.
  • It involves selecting, modifying & creating new features to improve model accuracy & efficiency.
  • By intelligently engineering features, data scientists can enhance model performance, reduce overfitting & speed up the training process.

63 of 83

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

Feature Construction:

  • It process discovers missing information about the relationships btw features and augments the feature by creating additional features.
  • Hence if there ‘n’ features or dimensions in a dataset, after feature construction ‘m’ more features or dimensions may get added.
  • So at the end, the dataset will become ‘n+m’ dimensional.

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.

64 of 83

2. Feature Subset Selection / Selection:

  • The objective of feature selection is to derive a subset of features from the full feature set which is most meaningful in the context of specific ML problem.

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.

65 of 83

Data Representation

  • Data refers to raw, unprocessed facts, figures & statistics, collected from various sources which can be analyzed to gain insights & make decisions.
  • In the context of ML, data is the foundation upon which models are built; it can be in the form of numbers, text, images, audio, or videos & it may contain info about different characteristics (features) of the phenomenon being studied.

Data Representation in ML:

  • It refers to the way in which data is structured & formatted to be used by an ML algorithm.
  • Since ML models learn patterns & make decisions based on data, it’s essential to represent the data in a way that enables efficient learning & accurate predictions.
  • Proper representation of data greatly influences model performance.

Types of Data Representation:

  1. Tabular Representation
  2. Text Representation
  3. Image Representation
  4. Time Series Representation
  5. Graph Representation

66 of 83

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.

67 of 83

2. Text Representation

Text data, such as sentences or document, need to be transformed into numerical format for ML algorithms.

Example: (BOW)

  • Sentence 1: "I love coding"
  • Sentence 2: "Coding is fun."
  • Vocabulary: {I, love, coding, is, fun}
  • Representation of Sentence 1: [1, 1, 1, 0, 0]
  • Representation of Sentence 2: [0, 0, 1, 1, 1]�

Usage: This representation is common in natural processing (NLP) tasks too like text classification, sentiment analysis, & Machine Translation.

68 of 83

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:

  • Image classification
  • Object detection
  • Segmentation

69 of 83

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

  • Stock price over time: [(t1, price1), (t2, price2), ……, (tn, price n)]

Usage: This format is used in tasks like forecasting, anomaly detection, or sequence prediction where time plays a crucial role.

70 of 83

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).

71 of 83

Model Selection

  • ML is a field that enables computers to learn patterns from data & make predictions without being explicitly programmed.
  • One of the most crucial aspects of ML is selecting the right model for a given problem. This process is called model selection. The choice of model significantly affects the accuracy, efficiency & reliability of predictions.
  • A bad model can cause overfitting or underfitting & sometimes even lead to increased computational costs.

Model Evaluation

  • It is the process of using different evaluation metrics to understand a ML model's performance, as well as its strengths & weaknesses.
  • A ML model is an algorithm trained on a dataset to perform a specific predictive task. Model Evaluation aims to define how well the model performs its task.

Why Evaluation necessary for a Successive model?

  • It is necessary for ensuring that ML models are reliable, generalizable & capable of making accurate predictions on new, unseen data, which is crucial for their successful deployment in real-world application.
  • Overfitting & underfitting are the biggest cause of poor performance of ML models.

72 of 83

  • Overfitting: Occurs when the model is so closely aligned to the training data that it does not know how to respond to new data.
  • Underfitting: Occurs when the model cannot adequately capture the underlying structure of the data.
  • Right fit: Occurs when both training data error & the test data are minimal.

73 of 83

Evaluation metrics

There are different metrics for the tasks of classification, regression, ranking, clustering, topic modelling etc. Some of the metrics are as follows:

  1. Classification metrics (accuracy, precision, recall, F1-score, ROC, AUC...)
  2. Regression Metrics (MSE, MAE, R2)
  3. Ranking Metrics (MRR, DCG, NDCG)
  4. Statistical Metrics (Correlation)
  5. Computer Vision Metrics (PSNR, SSIM, IoU)
  6. NLP Metrics (perplexity, BLEU score)
  7. Deep Learning Related Metrics (Inception score, Frechet inception distance)

Classification Metrics

  1. accuracy
  2. precision
  3. Recall
  4. F1 Score

74 of 83

Model Prediction:-

  • Model prediction is a statistical technique used to predict the outcomes of future events based on historical data. It involves building a mathematical model that takes a relevant Input Variable & generates a Predicted output variable.
  • ML Algorithms are used to train & improve these models to help make better decisions.
  • Predictive Modelling is used in many Industries & Applications. Can solve a wide range of issues, such as Fraud Detection, Customer Segmentation, Disease Diagnosis & stock price predictions.

There are 7 types of modeling techniques listed:

  1. Regression
  2. Neural Network
  3. Classification
  4. Clustering
  5. Time-Series
  6. Decision Tree
  7. Ensemble

75 of 83

Search and Learning

Search in ML

There are different types:

  1. Search Algorithms within AI
  2. Hyperparameter optimization
  3. Information Retrieval & Semantic Search
  4. Feature Selection
  5. Interconnection

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.

76 of 83

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).

77 of 83

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 2) Algorithm Application 3) Model Training 4)Generalization

1. Data Input

Providing the model with a dataset which can include:

  • Labelled examples (Supervised Learning)
  • Unlabelled data (Unsupervised Learning)
  • Interactions with an environment (Reinforcement Learning)

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.

78 of 83

Machine Learning Datasets

  • ML datasets are defined by a collection of data that can be used to train, test, and evaluate the model. This type of dataset makes programmers learn ML algorithms and execute the practical implementation of prediction.
  • The ML dataset was collected through various domains such as image recognition, text preprocessing, and sound or speech recognition.
  • ML algorithms & execute the practical implementation of prediction.
  • The ML dataset was collected through various domains such as image recognition, text preprocessing & sound or speech recognition.

Types of ML Datasets:

There are three different ways to categorize the dataset:

  1. Training Dataset: This type of dataset is used to train the model in ML.
  2. Validation Dataset: This type of dataset is optimized during the time of model training & helps to prevent overfitting.
  3. Testing Dataset: The testing dataset is not used during the time of training or validation & it is also termed a reserved dataset which can be used to evaluate the unseen data or model performance.

79 of 83

How to Split Dataset Effectively

Splitting your ML datasets into these three subsets is crucial for accurate model evaluation:

  • 70% Training
  • 15% Validation
  • 15% Testing

Sources to find ML Datasets

1. Public Datasets

  • Characteristics: Great for beginners and small projects, but often need significant preprocessing.
  • Examples: * Kaggle dataset
    • UCI Machine Learning Repository
    • iris.csv
    • weather.csv

2. Generated Data (Synthetic Data)

  • Characteristics: Provides full control but requires expertise and resources.
  • Examples: * Synthetic Data Vault (SDV)
    • Unity Perception

80 of 83

3. Government & Open Data

  • Characteristics: Reliable for specific domains but may not be comprehensive for advanced tasks.
  • Examples: * Data.gov
    • European Data Portal

4. Corporate / Domain-Specific Datasets

  • Characteristics: Perfect for niche applications but can be expensive and restricted.
  • Examples: * Microsoft Research Open Data
    • Lionbridge AI

5. Paid Services

  • Characteristics: Ensures quality and relevance but comes at a higher cost.
  • Examples: * Label Your Data
    • Appen

81 of 83

Top Resources of ML Dataset

  • UCI Machine Learning Repository
    • It was created by researchers.
    • It is used for both beginners and experts.
    • Ex: iris dataset / iris.csv

  • Kaggle
    • It is popular among all its competitive resources.
    • It’s an online platform that involves a community of data scientists, ML engineers, and researchers.
    • It is used in various domains such as image recognition, NLP (Natural Language Processing), and tabular data. (Ex: Alexa, Siri)
    • Ex: Housing dataset

  • Open Data on AWS
    • It is publicly available to users to download and access.
    • It is known for cloud-based access to facilitate research, analysis, and experimentation.
    • Ex: Amazon-product dataset

82 of 83

  • Google Dataset Search
    • It is used in every institution, university, and organization.
    • Ex: RTA Dataset

  • Azure Open Datasets
    • It is a cloud-based platform and it is hosted by the company Microsoft.
    • Ex: Air Conditioners Dataset

  • Government Open Data Portals
    • It can be used by developers, citizens, and businesses to access gov-generated data.
    • Ex: Country-wise dataset

  • GitHub
    • It serves as a hub for individuals to exchange ML datasets resembling a library housing sets of data vital for training and evaluating AI models.
    • Ex: Food Report

83 of 83