AAM UT-1 QB ANS
AAM UT-1 QB ANS
(2 Marks Questions):
Medicine: With the help of this algorithm, disease trends and risks of the
disease can be identified.
Land Use: We can identify the areas of similar land use by this algorithm.
There is no particular way to determine the best value for "K", so we need to try
some values to find the best out of them.
A very low value for K such as K=1 or K=2, can be noisy and lead to the
effects of outliers in the model.
Large values for K are good, but it may find some difficulties.
Elbow Method: Test different values of K and choose the one where the
error rate stabilizes or decreases marginally.
Advantages:
2. Works well with a clear margin of separation: SVM performs particularly well when
there is a distinct gap between classes, as it focuses on maximizing the margin between
them.
4. Versatile with different kernels: SVM can be adapted to various types of data,
including non-linear ones, by using kernel tricks, which help in mapping the data to
higher-dimensional spaces.
Disadvantages:
1. Computationally expensive for large datasets: Training an SVM can be slow and
memory-intensive for large datasets due to its complexity, especially when using non-
linear kernels.
2. Difficult to choose the correct kernel function: Selecting the right kernel (e.g., linear,
polynomial, RBF) and tuning the associated parameters (like C and gamma) requires
expertise and can be challenging.
3. Not suitable for noisy data: SVM may not perform well when the data contains a lot of
noise or overlapping classes.
4. Requires careful tuning: SVM has several hyperparameters (like the regularization
parameter, kernel type, and margin) that need to be fine-tuned for optimal performance,
which can be time-consuming.
Q.5) Explain the types of support vector machines
Linear SVM: Linear SVM is used for linearly separable data, which means if a
dataset can be classified into two classes by using a single straight line, then such
data is termed as linearly separable data, and classifier is used called as Linear
SVM classifier.
Non-linear SVM: Non-Linear SVM is used for non-linearly separated data, which
means if a dataset cannot be classified by using a straight line, then such data is
termed as non-linear data and classifier used is called as Non-linear SVM
classifier.
Root Node: Root node is from where the decision tree starts. It represents the
entire dataset, which further gets divided into two or more homogeneous sets.
Leaf Node: Leaf nodes are the final output node, and the tree cannot be segregated
further after getting a leaf node.
Splitting: Splitting is the process of dividing the decision node/root node into sub-
nodes according to the given conditions.
Pruning: Pruning is the process of removing the unwanted branches from the tree.
Parent/Child node: The root node of the tree is called the parent node, and other
nodes are called the child nodes.
Q.7) State any TWO advantages of KNN algorithm
Handles noisy data well: It’s good at ignoring errors or outliers in data.
Scales to large datasets: Works well with lots of data, though it can slow
down with huge datasets.
Handles many features: Works well with datasets that have many different
characteristics or variables.
(4 Marks Questions):
It involves selecting relevant information from raw data and transforming it into a
format that can be easily understood by a model.
The goal is to improve model accuracy by providing more meaningful and relevant
information.
Feature Selection: Choose the most important features using methods like
correlation, mutual information, or Recursive Feature Elimination (RFE).
Decision Tree is a Supervised learning technique that can be used for both
classification and Regression problems.
The feature with the highest Information Gain (IG) is chosen for the first split.
4. Make Predictions:
o Traverse the tree using feature values until a leaf node is reached.
o Assign the label of the leaf node as the prediction.
Example:
If we have a dataset with features Weather (Sunny, Rainy, Overcast) and a target Play
(Yes/No), we compute IG for Weather and split the tree accordingly.
Q.3) with the suitable example, explain how Bayes Theorem is applied
Bayes’ Theorem:
P (A) and P (B) = Are the probabilities of A and B occurring independently of one
another.
Example of Bayes Theorem:
Three bags contain 6 red, 4 black; 4 red, 6 black, and 5 red, 5 black balls
respectively. One of the bag is selected at random and a ball is drawn from it. If the
ball drawn is red, find the probability that it is drawn from the first bag.
Solution:
Let E1, E2, E3, and A be the events defined as follows:
Thus, the probability that the red ball was drawn from the first bag is 2/5 or 40%
Q.4) Describe types of ensemble learning methods.
2. Boosting:
Models are trained sequentially, with each new model correcting the errors of the
previous one.
Boosting gives higher weights to misclassified instances to improve performance.
Example: AdaBoost, Gradient Boosting, XGBoost.
3. Stacking:
Uses multiple base models and combines their outputs using a meta-learner (a
higher-level model).
The meta-learner learns how to best combine the base models’ predictions.
Example: Combining Decision Trees, SVM, and Neural Networks.
Advantages:
Increases model accuracy and reduces overfitting.
Works well with both classification and regression tasks.
Reduces variance and improves model robustness.
Q.5) Consider following training dataset of weather, apply Naive Bayes
Below is a training data set of weather and corresponding target variable ‘Play’
(suggesting possibilities of playing).
Now, we need to classify whether players will play or not based on weather
condition.
Problem: Players will play if the weather is sunny. Is this statement correct?
We can solve it using the above-discussed method of posterior Probability.
Dataset:
Given data:
Step 2: Interpretation