Quiz Space

Machine Learning Practice · End Term · 22 Dec 2024 · September 2024 term · Set QDD1

Question 35: What will be the output of the following code snippet?

Question 35

+3 marksNumerical answer

What will be the output of the following code snippet?

python
from sklearn.neighbors import KNeighborsClassifier
X_train = [[1, 50], [2, 60], [3, 70], [4, 80]]
y_train = [0, 0, 1, 1]
knn = KNeighborsClassifier(n_neighbors=3)
knn.fit(X_train, y_train)
X_test = [[2.5, 66]]
print(knn.predict(X_test))
Show answer

Correct answer: 1

Question 35 of 37 in the IIT Madras BS Machine Learning Practice (MLP) End Term paper sat on 22 Dec 2024, in the September 2024 term (IIT M IMPROVEMENT FN EXAM QDD1 22 Dec 2024). It carries 3 marks.

More questions from this paper

  1. Q1Dataset: Employee Details | Name | Age | Department | Salary | Joining_Year | Performance_Score | |---|---|---|---|---|…
  2. Q2Dataset: Employee Details | Name | Age | Department | Salary | Joining_Year | Performance_Score | |---|---|---|---|---|…
  3. Q3Dataset: Employee Details | Name | Age | Department | Salary | Joining_Year | Performance_Score | |---|---|---|---|---|…
  4. Q4Dataset: Employee Details | Name | Age | Department | Salary | Joining_Year | Performance_Score | |---|---|---|---|---|…
  5. Q5Which of the following code snippets will plot the learning curve for training over 100 epochs? Assume that all necessa…
  6. Q6Consider the following initialization of a DecisionTreeClassifier: If the training data consists of 100 samples and 10 …
  7. Q7Consider the following code: Which of the following is true in this case?
  8. Q8Consider the following code: What will be the output of the above code?
  9. Q9Figure question
  10. Q10The following code produces an output of 0.9125 on the training data. What is the expected effect on the training accur…
  11. Q11Figure question
  12. Q12Figure question
  13. Q13You're working on a binary classification task using the ‘MLPClassifier’ to predict whether a customer will make a purc…
  14. Q14What will be the output of the following code?
  15. Q15What will be the output of the following code?
  16. Q16You have loaded a dataset with 500 samples and 50 features into a Pandas DataFrame. Some samples have missing values fo…
  17. Q17Figure question
  18. Q18Figure question
  19. Q19What will be the output of the code?
  20. Q20Consider the following code snippet: What does the learning_rate='constant' parameter in the SGDRegressor() function co…
  21. Q21Which of the following is NOT a hyperparameter in machine learning?
  22. Q22Given below code to load a huge file name as filename.csv and this file is not loading at once in the system which para…
  23. Q23Figure question
  24. Q24Consider the following code: Which of the following sets of training data can not be printed during the iteration of St…
  25. Q25What happens when the following code is executed?
  26. Q26Figure question
  27. Q27Consider the following code snippet using scikit-learn: Assume all the necessary imports and X, y to be the training da…
  28. Q28Figure question
  29. Q29Figure question
  30. Q30What parameters of the k-means clustering algorithm should be tuned to optimize the model performance?
  31. Q31Consider the following options for evaluating the optimal number of clusters in k-means. Which approaches are valid?
  32. Q32Which of the following statements are correct about the Silhouette Coefficient?
  33. Q33Figure question
  34. Q34Given a dataset with shape 4 \times 3 (4 samples and 3 features), apply the VarianceThreshold method with a threshold o…
  35. Q36What will be the output of the following code?
  36. Q37Consider the following code and its output: Keep the following symbols in mind: >>>: Represents input code # : Represen…