Part B Unit 2 Running Notes and Textbook Questions
Part B Unit 2 Running Notes and Textbook Questions
AI technologies: This encompasses the tools, techniques, and methods used to create and apply
artificial intelligence. Classified into two categories;
1. Machine learning:
Machine Learning, or ML, enables machines to improve at tasks with experience. The
machine learns from its mistakes and takes them into consideration in the next execution. It
improvises itself using its own experiences.
Examples: Recommendation engines, speech recognition,and predicting grades.
This is just a broad representation of how a machine learning model works. Input (past or
historical data) is given to the ML model and the model generates output by learning from the
input data.
Here is an example which shows labelled images (every image is tagged either as apple or
strawberry) are given as input to the ML model. ML model learns from the input data to
classify between apples and strawberries and predicts the correct output as shown.
Input is given to an ANN, and after processing, the output is generated by the DL block. Here
is an example which shows pixels of a bird image given as input to the DL Model and the model
is able to analyze and correctly predict that it is a bird using a deep learning algorithm (ANN).
Real life examples of Deep Learning:
c. Object detection and Tracking: is used in tracking and detecting pedestrians or vehicles in real
time. Its application can be seen in autonomous vehicles for navigating streets and security systems for
monitoring intruders.
d. Gen AI: is used in generating realistic content that includes images, text and videos. Ex: Deep fake
videos and images.
Terminologies used with Data:
Data: Data is information in any form or raw facts that a machine uses to leran patterns and
predictions.
For e.g. A table with information about fruits is data
Each row will contain information about different fruits
Each fruit is described by certain features
Features: Columns of the tables are called features
In the fruit dataset example, features may be name,
color, size, etc.
Some features are special, they are called labels
Just like how a teacher teaches a topic to the class through a lot of examples and illustrations.
Just like how a teacher takes a class test related to a topic to evaluate the understanding level of
students.
Test is performed without labeled data and then verify results with labels.
Modelling: AI Modelling refers to developing algorithms, also called models which can be
trained to get intelligent outputs. That is, writing codes to make a machine artificially
intelligent.
Types of AI Models
Generally, AI models can be classified as follows:
Supervised Learning
Unsupervised
Machine Learning
Learning
Reinforcement
AI Models
Artificial Neural
Convolution Neural
Networks
1. Rule based Model: The rule Based Approach is one of the earliest and simplest methods of
implementing AI. It relies on predefined rules and facts created by developers to enable
machines to perform specific tasks and generate desired outputs.
Scenario: A clothing website has a Chabot to answer questions about order tracking.
1. Data: The Chabot doesn't require a massive dataset for training. It relies on a
predefined set of questions and corresponding answers.
2. Rules: The Chabot uses a decision tree approach with clearly defined rules to
understand user queries and provide responses. Here's a simplified example:
o Rule 1: If the user's message contains keywords like "track order," "shipment
status," or "delivery," proceed to order tracking options.
o Rule 2: Under order tracking options:
If the user asks for their order number, prompt them to enter it.
If the user enters a valid order number, retrieve the tracking information
from the database and display it.
If the user enters an invalid order number, provide an error message and ask
them to re-enter it.
o Rule 3: If the user's message doesn't match any defined rules, offer a
message like "Sorry, I can't help you with that. Perhaps you can try
searching our FAQs or contact customer support."
3. Interaction: When a user chats with the bot, their message is analyzed based
on the defined rules. The Chabot responds with a pre-written answer or prompts the
user for additional information depending on the scenario.
A drawback of this approach is that the learning is static. The machine once trained
cannot adapt to new data or rules. If the machine is tested on a dataset that differs from
the rules and data provided during the training stage, it will fail to produce accurate
results and will not learn or adjust for the new conditions.
For example, suppose you have a dataset of 1000 images of random stray dogs of your area. Now
you do not have any clue as to what trend is being followed in this dataset as you don’t know their
breed, or colour or any other feature. Thus, you would put this into a learning approach-based AI
machine and the machine would come up with various patterns it has observed in the features of
these 1000 images. It might cluster the data on the basis of colour, size, fur style, etc. It might also
come up with some very unusual clustering algorithm which you might not have even thought of!
Example 3:
In the example shown in the image, the model has
learned from labeled input data and produces output
to classify them as dogs and cats.
Therefore, you can see that the model learns from the
training data and then applies the same knowledge to test data.
Types of supervised learning:
There are 2 types of supervised learning model. They are Classification and regression.
on the basis of the grades they obtain with respect to their marks in the examination. This
model works on a discrete dataset which means the data need not be continuous.
In this case, the model would be trained on historical weather data that includes
temperature information labeled as "hot" or "cold". The model would learn the
patterns that differentiate hot and cold weather based on
factors like:
Classifying emails as spam or not: The model is shown tons of emails, both real
ones (like from friends or colleagues) and spam. The model learns what makes an
email look like spam. Once trained, the model sees a new email. It analyzes the clues
in the email and decides: is this spam or not? It assigns a category - "spam" or "not
spam" - just like sorting your mail.
In modern-day Email, classifiers identify if the email is spam and have evolved into
other categories such as social, advertisement, notifications, etc. Similar models are
increasingly being used in messaging applications.
b. Regression : It refers to a type of Supervised Learning
technique, which is based on a mathematical approach used to
predict the outcome. Regression models use continuous data.
For example, if you wish to predict your next salary, then you
would put in the data of your previous salary, any increments, etc.,
and would train the model.
Examples of the Regression Model
Predicting temperature
This model predicts the selling price of the car with the help of a few parameters like
fuel type,
years of service,
the number of previous owners,
kilometers driven,
transmission type (manual/automatic)
For example, In this example, we have input data with no class labels (unlabeled data), and this
input data comprises of birds and animals. Note that, even though there were no class labels, the
unsupervised learning model was able to divide this data into two clusters based on clustering.
The two clusters have been formed based on the similarity of characteristics. The first cluster
comprises all the animals, and the second cluster comprises all the birds.
Examples of clustering:
Jim enjoys listening to music. Jim likes to listen to music having slow tempo and soft
intensity whereas he dislikes songs having fast tempo and high intensity.
We have grouped all the songs having slow tempo and so intensity into 1 cluster that he likes
While, songs with a fast tempo and high intensity into another cluster
Now if he listens to a new song X with a slow tempo and so intensity. Could you predict
will he like the song X or not?
This is how clustering techniques work. The clustering model will be able to identify
clusters based on some similarities or patterns which are not defined in the input. For
example, tempo and intensity are the only features known, but clusters based on likes
and dislikes have been grouped together and given as output. Similar techniques are
used in OTT platforms like Netflix/Spotify for recommendations.
Association
Association Rule is an unsupervised learning method that is used to find interesting relationships
between variables from the database.
For example,
Based on the purchase pattern of customers A and B, can you predict any Customer
X who buys bread will most probably buy?
Based on the purchase pattern of other customers, we can predict that there is high
probability that any customer x who buys bread will most probably buy butter.
Therefore, such meaningful associations can be useful to recommend items to
customers. This is called Association Rule.
Advantages of Unsupervised Learning:
1. It is very useful in finding all kinds of unknown patterns and features in data.
2. As it works with unlabelled data, it makes it very useful in many real world situations
where labelling of data is not feasible.
3. Training data containing unlabelled data is easier to get than labelled data.
Disadvantages of Unsupervised data:
1. It is not easy to get the accuracy of the results as the input dataset is unlabelled.
2. The user needs to spend time interpreting and labelling the classes generated by the
system after training.
3. The clusters generated may not fit in with the new discoveries over time if new unknown
features are unearthed.
Some real life examples of Unsupervised learning:
Finding customer segments: Clustering algorithms have found great applications in finding
customer segments in marketing data. Examples like gender,location,age,education, and so on.
Reducing the complexity of a problem.
Document clustering.
Finding fraudulent transactions.
refers to an AI learning approach that trains algorithms using a system of reward and penalty.The
learning system learns in an interactive environment where the system iteratively selects and
performs actions and receives rewards by performing correctly and penalties for performing
incorrectly.
For example,
Reinforcement learning is a type of learning in which a machine learns to perform a task
through a repeated trial-and-error
method.
Let’s say you provide an image of an apple to the
machine and ask the machine to predict it-
The machine first predicts it as ‘cherry’ and you give
nega ve feedback that it’s incorrect.
Now, the machine learns that it’s not a cherry.
Then again, you ask the machine to predict the fruit
by giving an image of an apple as input;
Now, it knows it is not a cherry.
Family of
ML Models
Determine Learn by
Discover New
relationships Rewarding
Patterns
through training Actions
Mind Map for Machine Learning Models:
Deep Learning:
Deep Learning enables software to train itself to perform tasks with vast amounts of data. In deep
learning, the machine is trained with huge amounts of data which helps it to train itself around the
data. Such machines are intelligent enough to develop algorithms for themselves. There are two
types of Deep Learning models: Artificial Neural Networks (ANN) and Convolution Neural
Network (CNN).
Convolutional Neural Network (CNN) – it primarily used for image related tasks. It extracts
spatial features from data. It is used in image classification, medical imaging, facial recognition,
autonomous vehicles.
Neural Networks:
Neural networks are loosely modelled after
how neurons in the human brain behave. The
key advantage of neural networks is that they
are able to extract data features automatically
without needing the input of the programmer.
A neural network is essentially a system of
organizing machine learning algorithms to
perform certain tasks.
It is a fast and efficient way to solve problems for which the dataset is very large, such as in images.
This is a representation of how neural networks work:
It has 3 layers.
Input Layer: This is the starting point. Data is given here like images, numbers etc.,.
Hidden layer: The real work happens here. These layers process the data and try to understand
patterns using special rules called weights and biases.
The machine adjusts these weights until it gets better at giving correct answers.
Output layer: this layer gives the final result or answer.
How does AI make a decision?
Imagine you want to go outside- but you are not sure if you should carry an umbrella or wear a jacket.
Now we will fill in the four inputs with the factors that we have listed out.
•Do I have a jacket?
•Do I have umbrella?
•Is it sunny now?
•What is the weather forecast for later?
Now we will fill in the importance. But the importance is not very useful in mathematical
calculations.
Next, let us assign some numbers to them. At the same time, we will also assign a number for the
bias weight (WB).
How do we know what should be the actual values for the weights? We will not know what are the
actual weights. However, we can make some assumptions.
The values for the weights can come from experience. He may have an experience being sunny now
would most likely mean a bright day ahead, hence the high importance there. It can also come from
personal preference. A person may judge a particular factor more heavily as compared to another
person. For example, she may be more concerned with the weather forecast, hence the higher
importance there.
The values for WB are also based on personal preference. If a person is more cautious, he may set
the value for WB to be higher, hence his decision would gear towards staying indoors unless he is
sure that it would not rain. On another hand, a person who is more daring will have a lower WB,
hence he is more likely to go out regardless of the current situation. In this example, we choose 4 as
we want to be more cautious.
Therefore, there is no right or wrong answers in coming up with the values for the weights. However,
the effects of the values will determine the outcome that the person is going to take, whether to go
out or not. That is the reason why everyone comes up with a different decision, even though the
situation is the same for everyone.
For this example, let’s say: I have a jacket, I don’t have an umbrella, it is sunny now, and the weather
forecast is going to rain. We can convert the yes and no to numbers 1 and
0. For bias, we will always take 1.
From this calculation, the output is 0.5. Since this is higher than the threshold (which is zero),
the result is I will go out to the park.
Now let us change for another example.
let’s say: I don’t have a jacket, I have an umbrella, it is not sunny now, and the weather forecast is
ok. We will convert the yes and no to numbers 1 and 0. And similarly, for bias, we will take1.
Inputs weights Total Compare Decision
A. The main drawback of this approach is that the machine’s learning is static. Once trained,
the machine does not adapt to changes made in the original training dataset. If the machine is
tested on a dataset that differs from the rules and data provided during the training stage, it
will fail to produce accurate results and will not learn or adjust to the new conditions it
encounters.
2. What is a major advantage of the learning based approach over the rule based
approach?
A. The major advantage of the learning-based approach over the rule-based approach is its
adaptability—it can dynamically learn from data, recognize patterns, and improve over time
without manual updates, making it more flexible and scalable.
A. Classification: It’s a supervised learning technique that assigns data points to predefined
categories or labels. Labelled data is fed to the model. For example, classifying emails as
“Spam” or “Not Spam.”
Clustering: It is an unsupervised learning technique used to group similar data points into
clusters. The input data is unlabelled data. For example, grouping customers based on
shopping behaviour to target personalised marketing.
4. Explain the term Convolutional Neural Networks?
A. The Convolutional Neural Network is part of the Neural Networks that is primarily used
for image related tasks. It extracts spatial features from data. It is used in Image
classification (e.g., object detection), Medical imaging (e.g., tumor detection), Facial
recognition, Autonomous vehicles, etc.
5. What do you mean by a Testing Dataset?
A. The testing data set is a collection of data provided to a machine learning model to
evaluate how well it has learned to make predictions.
6. Name any four real world applications of Neural Networks.
A. Real-world applications of Neural Networks are fraud detection, recommendation
system, facial recognition, chatbots and virtual assistant, etc.
Speech Recognition: We all love to speak out our messages to Siri, Google assistant,
Amazon Alexa etc. These speech recognition devices use machine learning to understand
spoken language and convert speech to text and respond accordingly.
3. Differentiate between supervised and unsupervised learning models.
A.
Clustering, Dimensionality
Common Techniques Classification, Regression
Reduction