Consider the following code and output: In [57]: for k in range(1, 20, 2) :
) ..: kfold = KFold(n_splits=10, random_state=11, shuffle=True)
) ..: knn = KNeighborsClassifier(n_neighbors=k)
) ..: scores = cross_val_score(estimator=knn,
) ..: X=digits.data, y=digits.target, cv=kfold)
) ..: print(f'k={k:<2}; mean accuracy={scores.mean() :.2%}; ' +
) ..: f'standard deviation={scores.std() :.2%}')
) ..:
K=1 ; mean accuracy=98.83%; standard deviation=0.58%
K=3 ; mean accuracy=98.78%; standard deviation=0.78%
K=5 ; mean accuracy=98.72%; standard deviation=0.75%
K=7 ; mean accuracy=98.44%; standard deviation=0.96%
K=9 ; mean accuracy=98.39%; standard deviation=0.80%
K=11; mean accuracy=98.39%; standard deviation=0.80%
K=13; mean accuracy=97.89%; standard deviation=0.89%
K=15; mean accuracy=97.89%; standard deviation=1.02%
K=17; mean accuracy=97.50%; standard deviation=1.00%
K=19; mean accuracy=97.66%; standard deviation=0.96%
Which of the following statements is false?
A) The loop creates KNeighborsClassifiers with odd k values from 1 through 19 and performs k-fold cross-validation on each.
B) The k value 7 in kNN produces the most accurate predictions for the Digits dataset.
C) The accuracy tends to decrease for higher k values.
D) Compute time grows with k, because k-NN needs to perform many more calculations to find the nearest neighbors.
Correct Answer:
Verified
Q31: Which of the following statements is false?
A)
Q32: Which of the following statements a), b)
Q33: Which of the following statements is
Q34: Which of the following statements a), b)
Q35: Which of the following statements a), b)
Q37: Which of the following statements a), b)
Q38: Which of the following statements is false?
A)
Q39: Which of the following statements a), b)
Q40: The sklearn.metrics module's xe "sklearn.metrics module:classification_report function"xe
Q41: Which of the following statements is false?
A)
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents