Introduction to Machine Learning | Week 4

Session: JAN-APR 2024

Course name: Introduction to Machine Learning

Course Link: Click Here

For answers or latest updates join our telegram channel: Click here to join

These are Introduction to Machine Learning Week 4 Assignment 4 Answers


Q1. For a two-class classification problem, we use an SVM classifier and obtain the following separating hyperplane. We have marked 4 instances of the training data. Identify the point which will have the most impact on the shape of the boundary on its removal.
1
2
3
4

Answer: 1


Q2. Consider a soft-margin SVM with a linear kernel and no slack variables, trained on n points. The number of support vectors returned is k. By adding one extra point to the dataset and retraining the classifier, what is the maximum possible number of support vectors that can be returned (tuning parameter C)?
k
n
n + 1
k + 1

Answer: n + 1


For answers or latest updates join our telegram channel: Click here to join

These are Introduction to Machine Learning Week 4 Assignment 4 Answers


Q3. Consider the data set given below.
Claim: The PLA (Perceptron Learning Algorithm) can learn a classifier that achieves zero misclassification error on the training data. This claim is:

True
False
Depends on the initial weights
True, only if we normalize the feature vectors before applying PLA.

Answer: False


Q4. Consider the following dataset:
(Note: x is the feature and y is the output)
Which of these is not a support vector when using a Support Vector Classifier with a polynomial kernel with degree = 3, C = 1, and gamma = 0.1?
(We recommend using sklearn to solve this question.)

3
1
9
10

Answer: 3


For answers or latest updates join our telegram channel: Click here to join

These are Introduction to Machine Learning Week 4 Assignment 4 Answers


Q5. Which of the following is/are true about the Perceptron classifier?
It can learn a OR function
It can learn a AND function
The obtained separating hyperplane depends on the order in which the points are presented in the training process.
For a linearly separable problem, there exists some initialization of the weights which might lead to non-convergent cases.

Answer: a, b, c


Q6. In SVMs, a large functional margin represents a confident and correct prediction. Let the functional margins be defined as :
y^(i)=y(i)(wTx+b)
and the linear classifier as hw,b(x)=g(wTx+b) For any choice of suitable g(·), if we replace w by 2w and b by 2b, which of the following is likely to be observed?

No change in hw,b(x)=g(wTx+b).
Will result in reducing the functional margin by half.
Change in geometric margin.
None of the above.

Answer: No change in hw,b(x)=g(wTx+b).


For answers or latest updates join our telegram channel: Click here to join

These are Introduction to Machine Learning Week 4 Assignment 4 Answers


Q7. Consider the following optimization problem
min x2+1
s.t. (x−2)(x−4)≤0. Select the correct options regarding this optimization problem.

Strong Duality holds.
Strong duality doesn’t hold.
The Lagrangian can be written as L(x,λ)=(1+λ)x2−6λx+1+8λ
The dual objective will be g(λ)=−9λ21+λ+1+8λ

Answer: a, c


Q8. Suppose you have trained an SVM which is not performing well, and hence you have constructed more features from existing features for the model. Which of the following statements may be true?
We are lowering the bias.
We are lowering the variance.
We are increasing the bias.
We are increasing the variance.

Answer: a, d


For answers or latest updates join our telegram channel: Click here to join

These are Introduction to Machine Learning Week 4 Assignment 4 Answers

More Weeks of Introduction to Machine Learning: Click here

More Nptel Courses: https://progiez.com/nptel-assignment-answers


Session: JULY-DEC 2023

Course Name: Introduction to Machine Learning

Course Link: Click Here

These are Introduction to Machine Learning Week 4 Assignment 4 Answers


Q1. Consider the data set given below.
Claim: PLA (perceptron learning algorithm) can learn a classifier that achieves zero misclassification error on the training data. This claim is:

True
False
Depends on the initial weights
True, only if we normalize the feature vectors before applying PLA.

Answer: False


Q2. Which of the following loss functions are convex? (Multiple options may be correct)
0-1 loss (sometimes referred as mis-classification loss)
Hinge loss
Logistic loss
Squared error loss

Answer: b, c, d


These are Introduction to Machine Learning Week 4 Assignment 4 Answers


Q3. Which of the following are valid kernel functions?
(1+)d
tanh(K1+K2)
exp(−γ||x−x’||2)

Answer: a, b, c


These are Introduction to Machine Learning Week 4 Assignment 4 Answers


Q4. Consider the 1 dimensional dataset:
(Note: x is the feature, and y is the output)
State true or false: The dataset becomes linearly separable after using basis expansion with the following basis function ϕ(x)=[1×3]

True
False

Answer: False


These are Introduction to Machine Learning Week 4 Assignment 4 Answers


Q5. State True or False:
SVM cannot classify data that is not linearly separable even if we transform it to a higherdimensional space.

True
False

Answer: False


These are Introduction to Machine Learning Week 4 Assignment 4 Answers


Q6. State True or False:
The decision boundary obtained using the perceptron algorithm does not depend on the initial values of the weights.

True
False

Answer: False


These are Introduction to Machine Learning Week 4 Assignment 4 Answers


Q7. Consider a linear SVM trained with n labeled points in R2 without slack penalties and resulting in k=2 support vectors, where n>100. By removing one labeled training point and retraining the SVM classifier, what is the maximum possible number of support vectors in the resulting solution?
1
2
3
n − 1
n

Answer: n − 1


These are Introduction to Machine Learning Week 3 Assignment 3 Answers


Q8. Consider an SVM with a second order polynomial kernel. Kernel 1 maps each input data point x to K1(x)=[xx2]. Kernel 2 maps each input data point x to K2(x)=[3x3x2]. Assume the hyper-parameters are fixed. Which of the following option is true?
The margin obtained using K2(x) will be larger than the margin obtained using K1(x).
The margin obtained using K2(x) will be smaller than the margin obtained using K1(x).
The margin obtained using K2(x) will be the same as the margin obtained using K1(x).

Answer: The margin obtained using K2(x) will be larger than the margin obtained using K1(x).


These are Introduction to Machine Learning Week 4 Assignment 4 Answers

More Weeks of INTRODUCTION TO MACHINE LEARNING: Click here

More Nptel Courses: Click here


Session: JAN-APR 2023

Course Name: Introduction to Machine Learning

Course Link: Click Here

These are Introduction to Machine Learning Week 4 Assignment 4 Answers


Q1. Consider a Boolean function in three variables, that returns True if two or more variables out of three are True, and False otherwise. Can this function be implemented using the perceptron algorithm?
a. no
b. yes

Answer: b. yes


Q2. For a support vector machine model, let xi be an input instance with label yi. If yi(β^0+xTiβ^)>1, where β0 and β^) are the estimated parameters of the model, then
a. xi is not a support vector
b. xi is a support vector
c. xi is either an outlier or a support vector
d. Depending upon other data points, x i may or may not be a support vector.

Answer: a. xi is not a support vector


These are Introduction to Machine Learning Week 4 Assignment 4 Answers


Q3. Suppose we use a linear kernel SVM to build a classifier for a 2-class problem where the training data points are linearly separable. In general, will the classifier trained in this manner be always the same as the classifier trained using the perceptron training algorithm on the same training data?
a. Yes
b. No

Answer: b. No


For Q4,5: Kindly download the synthetic dataset from the following link

Click here to view the dataset

The dataset contains 1000 points and each input point contains 3 features.

Q4. Train a linear regression model (without regularization) on the above dataset. Report the coefficients of the best fit model. Report the coefficients in the following format: β0,β1,β2,β3. (You can round-off the accuracy value to the nearest 2-decimal point number.)
a. -1.2, 2.1, 2.2, 1
b. 1, 1.2, 2.1, 2.2
c. -1, 1.2, 2.1, 2.2
d. 1, -1.2, 2.1, 2.2
e. 1, 1.2, -2.1, -2.2

Answer: d. 1, -1.2, 2.1, 2.2


These are Introduction to Machine Learning Week 4 Assignment 4 Answers


Q5. Train an l2 regularized linear regression model on the above dataset. Vary the regularization parameter from 1 to 10. As you increase the regularization parameter, absolute value of the coefficients (excluding the intercept) of the model:
a. increase
b. first increase then decrease
c. decrease
d. first decrease then increase

Answer: c. decrease


These are Introduction to Machine Learning Week 4 Assignment 4 Answers


For Q6,7: Kindly download the modified version of Iris dataset from this link.

Available at: (Click here to view the Iris dataset)

The dataset contains 150 points and each input point contains 4 features and belongs to one among three classes. Use the first 100 points as the training data and the remaining 50 as test data. In the following questions, to report accuracy, use test dataset. You can round-off the accuracy value to the nearest 2-decimal point number. (Note: Do not change the order of data points.)

These are Introduction to Machine Learning Week 4 Assignment 4 Answers

Q6. Train an l2 regularized logistic regression classifier on the modified iris dataset. We recommend using sklearn. Use only the first two features for your model. We encourage you to explore the impact of varying different hyperparameters of the model. Kindly note that the C parameter mentioned below is the inverse of the regularization parameter λ. As part of the assignment train a model with the following hyperparameters:
Model: logistic regression with one-vs-rest classifier, C=1e4
For the above set of hyperparameters, report the best classification accuracy

a. 0.88
b. 0.86
c. 0.98
d. 0.68

Answer: b. 0.86


These are Introduction to Machine Learning Week 4 Assignment 4 Answers


Q7. Train an SVM classifier on the modified iris dataset. We recommend using sklearn. Use only the first two features for your model. We encourage you to explore the impact of varying different hyperparameters of the model. Specifically try different kernels and the associated hyperparameters. As part of the assignment train models with the following set of hyperparameters
RBF-kernel, gamma=0.5, one-vs-rest classifier, no-feature-normalization. Try C=0.01,1,10. For the above set of hyperparameters, report the best classification accuracy along with total number of support vectors on the test data.

a. 0.92, 69
b. 0.88, 40
c. 0.88, 69
d. 0.98, 41

Answer: c. 0.88, 69


These are Introduction to Machine Learning Week 4 Assignment 4 Answers

More Weeks of Introduction to Machine Learning: Click Here

More Nptel courses: https://progiez.com/nptel


Session: JUL-DEC 2022

These are Introduction to Machine Learning Week 4 Assignment 4 Answers

Course Name: INTRODUCTION TO MACHINE LEARNING

Link to Enroll: Click Here


Q1. Consider the 1-dimensional dataset:
State true or false: The dataset becomes linearly separable after using basis expansion with the following basis function ϕ(x)=[1×3]ϕ(x)=[1×3]

These are the solutions of NPTEL INTRODUCTION TO MACHINE LEARNING ASSIGNMENT 4 WEEK 4

a. True
b.False

Answer: a. True


These are Introduction to Machine Learning Week 4 Assignment 4 Answers


Q2. Consider a linear SVM trained with nn labeled points in R2R2 without slack penalties and resulting in k=2k=2 support vectors, where n>100n>100. By removing one labeled training point and retraining the SVM classifier, what is the maximum possible number of support vectors in the resulting solution?
a. 1
b. 2
c. 3
d. n − 1
e. n

Answer: b. 2


These are Introduction to Machine Learning Week 4 Assignment 4 Answers


Q3. Which of the following are valid kernel functions?
a. (1+<x,x’>)d(1+<x,x′>)d
b. tanh(K1<x,x’>+K2)
c. exp(−γ||x−x’||2)

Answer: a, b, c


These are Introduction to Machine Learning Week 4 Assignment 4 Answers


Q4. Consider the following dataset:

These are the solutions of NPTEL INTRODUCTION TO MACHINE LEARNING ASSIGNMENT 4 WEEK 4

Which of these is not a support vector when using a Support Vector Classifier with a polynomial kernel with degree =3,C=1,=3,C=1, and gamma =0.1?=0.1?
a. 3
b.1
c. 9
d. 10

Answer: b.1


These are Introduction to Machine Learning Week 4 Assignment 4 Answers


Q5. Consider an SVM with a second order polynomial kernel. Kernel 1 maps each input data point xx to K1(x)=[x x2]. Kernel 2 maps each input data point xx to K2(x)=[3x 3×2]K2(x). Assume the hyper-parameters are fixed. Which of the following option is true?
a. The margin obtained using K2(x)K2(x) will be larger than the margin obtained using K1(x)K1(x).
b. The margin obtained using K2(x)K2(x) will be smaller than the margin obtained using K1(x)K1(x).
c. The margin obtained using K2(x)K2(x) will be the same as the margin obtained using K1(x)K1(x).

Answer: c. The margin obtained using K2(x)K2(x) will be the same as the margin obtained using K1(x)K1(x).


These are Introduction to Machine Learning Week 4 Assignment 4 Answers


Q6. Train a Linear perceptron classifier on the modified iris dataset. Report the best classification accuracy for l1 and elasticnet penalty terms.
a. 0.82, 0.64
b. 0.90, 0.71
c. 0.84, 0.82
d. 0.78, 0.64

Answer: b. 0.90, 0.71


These are Introduction to Machine Learning Week 4 Assignment 4 Answers


Q7. Train an SVM classifier on the modified iris dataset. We encourage you to explore the impact of varying different hyperparameters of the model. Specifically, try different kernels and the associated hyperparameters. As part of the assignment, train models with the following set of hyperparameters
poly, gamma=0.4gamma=0.4, one-vs-rest classifier, no-feature-normalization.

a. 0.98
b. 0.96
c. 0.92
d. 0.94

Answer: a. 0.98


These are Introduction to Machine Learning Week 4 Assignment 4 Answers

More weeks solution of this course: https://progies.in/answers/nptel/introduction-to-machine-learning

More NPTEL Solutions: https://progies.in/answers/nptel


Introduction to Machine Learning Week 4 Assignment 4
The content uploaded on this website is for reference purposes only. Please do it yourself first.