Quiz Space

Machine Learning Practice Quiz 2: 6 August 2023 (May 2023 term)

Question 1

+2 marksNumerical answer

Consider the following code and its output:

Code:

python
from sklearn.datasets import load_iris
from sklearn.linear_model import LogisticRegression
X, y = load_iris(return_X_y=True)
clf = LogisticRegression(random_state=0).fit(X, y)
print(y[70:80])
print(clf.predict(X[70:80, :]))

Output:

text
[1 1 1 1 1 1 1 1 1 1]
[2 1 1 1 1 1 1 2 1 1]

What will be the output of the following code? Enter your answer correct to one decimal place.

python
print(clf.score(X[70:80, :], y[70:80]))

Question 2

+2 marksNumerical answer

Question 3

+2 marksNumerical answer

What will be the output of the following code ?

python
from sklearn.neighbors import KNeighborsClassifier
X_train = [[1,100],[4,400],[5,500],[6,600],[8,800],[9,900],
[11,1100],[12,1200],[15,1500], [18,1800],[19,1900]]
y_train = [0,0,1,1,1,2,2,2,2,2,2]
X_test = [[2,200]]
knn = KNeighborsClassifier(n_neighbors= len(y_train),
metric="euclidean",
weights= 'uniform')
knn.fit(X_train,y_train)
print(knn.predict(X_test))

20 more questions in this paper

Sign in with Google — it is free — to see every question with its answer and explanation, practise it in learning mode, or take it as a timed mock test.

More on the MLP Quiz 2 6 Aug 2023 paper

The IIT Madras BS Machine Learning Practice (MLP) Quiz 2 paper sat on 6 Aug 2023, in the May 2023 term: 23 questions for 50 marks in 120 minutes. The first 3 questions are below. Sign in with Google — it is free — to see the whole paper with its answers and explanations, in learning mode or as a timed mock test.

FeatureMLP Quiz 2 6 Aug 2023 at a glance
TermMay 2023 term
SubjectMachine Learning Practice
Course codeBSCS2008
Questions23
Marks50
Duration120 min
Numerical5
MCQ13
MSQ5
Official paperIIT M DIPLOMA AN2 EXAM QPD2 06 Aug 2023
Negative markingNo negative marking.
Updated

Same Quiz 2, other subjects

More MLP