0% found this document useful (0 votes)
391 views

ML LAB Viva Questions with Answers

The document contains a series of viva questions and answers related to machine learning concepts, covering topics such as IDE installation, data preprocessing, various regression techniques, classification algorithms, ensemble learning, and dimensionality reduction. Each week focuses on different machine learning techniques, providing foundational knowledge and practical applications. The content is structured to facilitate understanding and application of machine learning principles in various scenarios.

Uploaded by

adianpearce69
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
391 views

ML LAB Viva Questions with Answers

The document contains a series of viva questions and answers related to machine learning concepts, covering topics such as IDE installation, data preprocessing, various regression techniques, classification algorithms, ensemble learning, and dimensionality reduction. Each week focuses on different machine learning techniques, providing foundational knowledge and practical applications. The content is structured to facilitate understanding and application of machine learning principles in various scenarios.

Uploaded by

adianpearce69
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

ML LAB Viva Questions with Answers

Week 1 & 2: Installation of IDE, Demonstration of Packages

1. Question: What is the purpose of an Integrated Development Environment (IDE)?


 Answer: An IDE provides a comprehensive environment for software
development, combining code editing, debugging, and project management
tools in one place.
2. Question: Why is package management important in programming?
 Answer: Package management simplifies the process of installing, updating, and
managing third-party libraries and dependencies, enhancing code efficiency and
maintainability.
3. Question: Can you name a popular package manager for Python, and how do you use it
to install a package?
 Answer: One popular Python package manager is pip. To install a package, you
use the command pip install package_name.
4. Question: What are the advantages of using an IDE over a simple text editor for
programming?
 Answer: IDEs offer features like code completion, debugging tools, and project
navigation, providing a more efficient and productive development experience
compared to a basic text editor.
5. Question: How can you create a virtual environment in Python, and why might you
want to use one?
 Answer: Use the command python -m venv venv_name to create a virtual
environment. Virtual environments isolate project dependencies, preventing
conflicts and ensuring a clean environment for each project.

Week 3: Program to Demonstrate Different Kinds of


Preprocessing

1. Question: What is data preprocessing, and why is it essential in machine learning?


 Answer: Data preprocessing involves cleaning and transforming raw data into a
suitable format for machine learning models. It is crucial for improving model
accuracy and performance.
2. Question: Name three common techniques used in data preprocessing.
 Answer: Techniques include handling missing data, normalization, and encoding
categorical variables.
3. Question: How does normalization contribute to the preprocessing of numerical data?
 Answer: Normalization scales numerical features to a standard range, preventing
certain features from dominating others and improving the model's convergence
during training.
4. Question: Explain the concept of one-hot encoding and its application in preprocessing.
 Answer: One-hot encoding converts categorical variables into binary vectors,
representing each category as a unique binary combination. It is useful when
dealing with categorical data in machine learning models.
5. Question: When would you use feature scaling during data preprocessing, and how
does it impact machine learning models?
 Answer: Feature scaling is applied when features have different scales. It ensures
that no feature dominates the others, leading to more stable and accurate
models.

Week 4: Program to Demonstrate Simple Linear Regression

1. Question: What is the objective of simple linear regression in machine learning?


 Answer: Simple linear regression aims to establish a linear relationship between
a dependent variable and a single independent variable.
2. Question: Describe the formula for the equation of a straight line in simple linear
regression.
 Answer: The equation is y = mx + b, where y is the dependent variable, x is the
independent variable, m is the slope, and b is the y-intercept.
3. Question: How is the performance of a simple linear regression model typically
evaluated?
 Answer: Common evaluation metrics include mean squared error (MSE) and R-
squared, which measure the accuracy and goodness of fit of the model,
respectively.
4. Question: What is the significance of the slope coefficient in the context of simple linear
regression?
 Answer: The slope coefficient (m) represents the change in the dependent
variable for a one-unit change in the independent variable, indicating the
strength and direction of the relationship.
5. Question: When is simple linear regression most appropriate, and what are its
limitations?
 Answer: Simple linear regression is suitable when there is a linear relationship
between two variables. Its limitations include sensitivity to outliers and the
assumption of a constant variance of errors.
Week 5: Program to Demonstrate Ridge Regression and Lasso
Regression

1. Question: What problem do ridge regression and lasso regression address in linear
regression models?
 Answer: They address the issue of multicollinearity and overfitting by introducing
regularization terms to the linear regression equation.
2. Question: Explain the key difference between ridge regression and lasso regression.
 Answer: Ridge regression adds a regularization term with the squared
magnitude of coefficients, while lasso regression adds the absolute magnitude.
Lasso can lead to sparsity by setting some coefficients to exactly zero.
3. Question: When would you choose ridge regression over lasso regression, and vice
versa?
 Answer: Ridge regression is preferred when all features are expected to
contribute to the model, while lasso regression is suitable when feature selection
is crucial, and some features can be omitted.
4. Question: How does the regularization term in ridge regression contribute to
preventing overfitting?
 Answer: The regularization term penalizes large coefficients, discouraging
complex models and reducing the risk of overfitting.
5. Question: What is the significance of the regularization parameter in ridge and lasso
regression?
 Answer: The regularization parameter controls the strength of regularization. A
higher value increases the penalty on large coefficients, influencing the model's
complexity.

Week 6: Program to Demonstrate K-Nearest Neighbor


Classification

1. Question: What is the fundamental principle behind K-Nearest Neighbor (KNN)


classification?
 Answer: KNN classifies data points based on the majority class of their k nearest
neighbors in the feature space.
2. Question: How do you choose the value of k in KNN, and what impact does it have on
the model?
 Answer: The choice of k depends on the dataset and is often determined
through cross-validation. A smaller k increases model sensitivity to noise, while a
larger k may oversimplify the model.
3. Question: What are the key considerations when selecting a distance metric in KNN?
 Answer: Common distance metrics include Euclidean distance and Manhattan
distance. The choice depends on the nature of the data and the desired behavior
of the model.
4. Question: How does KNN handle categorical features in classification tasks?
 Answer: For categorical features, KNN typically uses distance metrics suitable for
categorical data, such as the Hamming distance.
5. Question: What are the advantages and disadvantages of KNN as a classification
algorithm?
 Answer: Advantages include simplicity and effectiveness, while disadvantages
include sensitivity to outliers and the need for sufficient training data. It is
computationally expensive for large datasets.

Week 7: Program to Demonstrate Decision Tree - ID3 Algorithm

1. Question: What is the ID3 algorithm, and how does it work in the context of decision
trees?
 Answer: The Iterative Dichotomiser 3 (ID3) algorithm is a decision tree algorithm that
recursively selects the best attribute to split the data based on information gain, aiming
to maximize the homogeneity of the resulting subsets.
2. Question: How does information gain influence the decision-making process in the ID3
algorithm?
 Answer: Information gain measures the effectiveness of an attribute in reducing
uncertainty about the classification. The ID3 algorithm selects the attribute with the
highest information gain for node splitting.
3. Question: Explain the concept of entropy and its role in the ID3 algorithm.
 Answer: Entropy quantifies the impurity or disorder of a set. ID3 minimizes entropy by
selecting attributes that lead to subsets with lower entropy, resulting in more
homogeneous classes.
4. Question: What are the limitations of the ID3 algorithm, and how can they be
addressed?
 Answer: ID3 is sensitive to noise and outliers. Pruning techniques, such as post-pruning
or pre-pruning, can be applied to mitigate overfitting and improve generalization.
5. Question: How does the decision tree represent knowledge, and how can it be
visualized?
 Answer: A decision tree represents knowledge through a tree-like structure where each
node corresponds to a test on an attribute, and each branch represents an outcome of
the test. Visualization tools like Graphviz can be used to create graphical representations.
Week 8: Program to Demonstrate Naive Bayes Classifier and
Logistic Regression
a. Naive Bayes Classifier
1. Question: What makes the Naive Bayes Classifier "naive"?
 Answer: The "naive" assumption in Naive Bayes is that features are conditionally
independent given the class label, simplifying the calculation of probabilities.
2. Question: How is the Naive Bayes Classifier applied in text classification tasks?
 Answer: In text classification, Naive Bayes is used to calculate the probability of a
document belonging to a particular class based on the probabilities of individual words
occurring in that class.
3. Question: Explain Laplace smoothing and its role in Naive Bayes.
 Answer: Laplace smoothing is used to handle the issue of zero probabilities for unseen
features. It involves adding a small constant to all feature counts to avoid division by
zero.
4. Question: In what scenarios is the Naive Bayes Classifier particularly suitable?
 Answer: Naive Bayes is effective in text classification, spam filtering, and situations
where the independence assumption is reasonable.
5. Question: How does Naive Bayes handle continuous features, and what is the role of
probability density functions?
 Answer: For continuous features, Naive Bayes assumes a probability density function,
often Gaussian, to estimate the likelihood of a given value.

b. Program to Demonstrate Logistic Regression


1. Question: What is the fundamental difference between linear regression and logistic
regression?
 Answer: Linear regression predicts continuous outcomes, while logistic regression is
used for binary or categorical outcomes by modeling the probability of belonging to a
particular class.
2. Question: How is the logistic function (sigmoid function) used in logistic regression?
 Answer: The logistic function transforms the linear combination of features into a
probability between 0 and 1, allowing logistic regression to model the likelihood of a
binary outcome.
3. Question: What is the role of the log-odds in logistic regression, and why is it used?
 Answer: The log-odds, also known as the logit function, is the logarithm of the odds of
the event occurring. It is used in logistic regression to linearize the relationship between
predictors and the log-odds of the response variable.
4. Question: Explain the concept of regularization in logistic regression.
 Answer: Regularization in logistic regression involves adding a penalty term to the cost
function to prevent overfitting by discouraging overly complex models.
5. Question: How is logistic regression used in multiclass classification problems?
 Answer: In multiclass problems, logistic regression can be extended using techniques
like one-vs-all (OvA) or one-vs-one (OvO) to handle multiple classes.

Week 9: Program to Demonstrate SVM-based Classification

1. Question: What is a Support Vector Machine (SVM), and how does it work in
classification?
 Answer: SVM is a supervised machine learning algorithm that finds the hyperplane that
maximally separates classes in feature space. It aims to maximize the margin between
classes.
2. Question: Explain the concept of a hyperplane in SVM.
 Answer: A hyperplane is a decision boundary that separates classes in feature space. In
SVM, the optimal hyperplane is the one that maximizes the margin, the distance
between the hyperplane and the nearest data points of each class.
3. Question: What is the significance of support vectors in SVM?
 Answer: Support vectors are the data points that lie closest to the hyperplane and
influence its position. They play a crucial role in determining the optimal hyperplane.
4. Question: How does SVM handle nonlinearly separable data?
 Answer: SVM can handle nonlinearly separable data by using kernel functions, which
implicitly map the input features into a higher-dimensional space, making them
separable.
5. Question: What are the key parameters in an SVM model, and how do they impact
model performance?
 Answer: Key parameters include the choice of kernel, the regularization parameter (C),
and the kernel parameters. Tuning these parameters can significantly impact the SVM's
ability to generalize to new data.

Week 10: Program to Demonstrate Ensemble Learning


Algorithms: Bagging and Boosting

1. Question: What is the concept of ensemble learning, and why is it used in machine
learning?
 Answer: Ensemble learning combines the predictions of multiple models to improve
overall performance and generalization, reducing the risk of overfitting.
2. Question: How does bagging (Bootstrap Aggregating) work in the context of ensemble
learning?
 Answer: Bagging creates multiple subsets of the training data through bootstrap
sampling and trains a base model on each subset. The final prediction is obtained by
averaging or voting.
3. Question: Explain the boosting algorithm and its purpose in ensemble learning.
 Answer: Boosting focuses on iteratively improving the performance of weak learners by
assigning higher weights to misclassified instances. It aims to create a strong learner
from a collection of weak learners.
4. Question: What is the significance of the learning rate in boosting algorithms?
 Answer: The learning rate controls the contribution of each weak learner to the final
model. A lower learning rate requires more iterations but may lead to better
convergence.
5. Question: When would you choose bagging over boosting or vice versa?
 Answer: Bagging is effective when the base models are unstable or prone to overfitting,
while boosting excels in improving the performance of weak models, making it suitable
for scenarios where accuracy is crucial.

Week 11: Program to Demonstrate Random Forest Algorithm

1. Question: How does a Random Forest differ from a traditional decision tree?
 Answer: A Random Forest is an ensemble of decision trees, where each tree is trained
on a random subset of the data and a random subset of features. The final prediction is
an average or voting of individual tree predictions.
2. Question: What is the purpose of feature bagging in a Random Forest?
 Answer: Feature bagging involves considering only a random subset of features when
splitting nodes in individual decision trees. It enhances diversity among trees and
improves overall model generalization.
3. Question: How does a Random Forest handle overfitting compared to a single decision
tree?
 Answer: The aggregation of predictions from multiple trees in a Random Forest tends to
reduce overfitting, as individual errors are likely to cancel out, leading to a more robust
model.
4. Question: Explain the concept of out-of-bag (OOB) error in Random Forest.
 Answer: OOB error is the prediction error on the instances not used in the training set of
a particular tree. It serves as an estimate of the model's performance on unseen data.
5. Question: In what types of problems is a Random Forest particularly effective?
 Answer: Random Forests are effective in a wide range of problems, including
classification, regression, and tasks with a large number of features.

Week 12: Program to Demonstrate PCA on Any Dataset

1. Question: What is Principal Component Analysis (PCA), and what is its primary
objective?
 Answer: PCA is a dimensionality reduction technique that aims to capture the most
important information in a dataset by transforming it into a new set of uncorrelated
variables called principal components.
2. Question: How does PCA identify the principal components, and what information do
they represent?
 Answer: PCA identifies the principal components as linear combinations of the original
features. The first principal component represents the direction of maximum variance,
and subsequent components capture orthogonal directions of decreasing variance.
3. Question: Explain the concept of eigenvalues and eigenvectors in the context of PCA.
 Answer: Eigenvalues represent the variance captured by each principal component, and
eigenvectors represent the directions of these components in the feature space.
4. Question: What is the trade-off between the number of principal components and the
explained variance?
 Answer: Increasing the number of principal components explains more variance but may
lead to overfitting. A balance must be struck to retain sufficient information while
reducing dimensionality.
5. Question: How can PCA be applied to preprocess data before feeding it into a machine
learning model?
 Answer: PCA can be used to reduce the dimensionality of the data, eliminating
redundant information and speeding up training without sacrificing too much predictive
power.

Week 13: Program to Demonstrate K-Means Clustering Algorithm

1. Question: What is the main objective of the K-Means clustering algorithm?


 Answer: The main objective of K-Means is to partition a dataset into k clusters,
where each data point belongs to the cluster with the nearest mean, minimizing
the sum of squared distances within each cluster.
2. Question: How does the K-Means algorithm initialize cluster centroids, and why is it
important?
 Answer: K-Means typically initializes centroids randomly or using a heuristic. The
choice of initial centroids can impact convergence, and techniques like k-
means++ aim to improve initialization.
3. Question: Explain the iterative process of the K-Means algorithm.
 Answer: K-Means iteratively assigns data points to the nearest cluster centroid
and updates centroids based on the mean of the points in each cluster until
convergence.
4. Question: What is the significance of the elbow method in determining the optimal
number of clusters in K-Means?
 Answer: The elbow method involves plotting the sum of squared distances
against the number of clusters and selecting the "elbow" point where the rate of
decrease slows down. It helps determine a suitable number of clusters.
5. Question: How does K-Means handle outliers, and what impact can outliers have on the
results?
 Answer: K-Means is sensitive to outliers as they can disproportionately influence
centroid positions. Preprocessing techniques or robust variants of K-Means can
be applied to mitigate this effect.

Week 14: Program to Demonstrate DBSCAN Clustering Algorithm

1. Question: What does DBSCAN stand for, and what distinguishes it from other clustering
algorithms?
 Answer: DBSCAN stands for Density-Based Spatial Clustering of Applications
with Noise. Unlike K-Means, DBSCAN identifies clusters based on data density
and can discover clusters of arbitrary shapes.
2. Question: Explain the core concepts of DBSCAN, such as epsilon (ε) and minimum
points (MinPts).
 Answer: ε is the radius within which MinPts data points are considered part of
the same neighborhood. MinPts is the minimum number of data points required
to form a dense region.
3. Question: How does DBSCAN classify data points as core points, border points, and
noise points?
 Answer: Core points have at least MinPts data points within ε, border points are
within ε of a core point but have fewer than MinPts neighbors, and noise points
do not satisfy the density criteria.
4. Question: What are the advantages of DBSCAN in handling clusters of varying shapes
and sizes?
 Answer: DBSCAN can identify clusters with irregular shapes and adapt to varying
densities within the dataset. It is not constrained by assumptions about cluster
shapes.
5. Question: How does DBSCAN handle outliers, and why is it considered robust to noise?
 Answer: DBSCAN naturally identifies noise as data points that do not belong to
any cluster. Its density-based approach makes it robust to outliers, and clusters
are only formed where there is sufficient density.

Week 15: Program to Demonstrate Comparison and Evaluation of


Clustering Algorithms

1. Question: Why is it important to compare and evaluate clustering algorithms?


 Answer: Comparing and evaluating clustering algorithms is crucial to understand
their performance characteristics, strengths, and weaknesses. It helps in selecting
the most suitable algorithm for specific datasets and applications.
2. Question: What are common metrics used to evaluate the performance of clustering
algorithms?
 Answer: Common metrics include silhouette score, Davies-Bouldin index, and the
adjusted Rand index. They assess aspects such as cluster cohesion, separation,
and similarity to ground truth (if available).
3. Question: Explain the concept of the silhouette score and how it is interpreted.
 Answer: The silhouette score measures how similar an object is to its own cluster
compared to other clusters. It ranges from -1 to 1, where a higher value indicates
better-defined clusters.
4. Question: When might external validation measures, such as the adjusted Rand index,
be useful in clustering evaluation?
 Answer: External validation measures are useful when ground truth information
about the correct clustering is available. The adjusted Rand index quantifies the
similarity between predicted and true clusters.
5. Question: What challenges might arise in comparing clustering algorithms, and how
can they be addressed?
 Answer: Challenges include sensitivity to initialization, varying cluster shapes,
and dataset characteristics. Multiple runs with different initializations, using
robust algorithms, and considering domain-specific knowledge can address these
challenges.

You might also like