logo

Crowdly

Browser

Add to Chrome

Consider the following code snippet for a nearest centroid classifier: from sk...

✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.

Consider the following code snippet for a nearest centroid classifier:

from sklearn.datasets import load_digits

from sklearn.model_selection import train_test_split

from sklearn.metrics import accuracy_score

import numpy as np

digits = load_digits()

X, y = digits.data, digits.target

X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)

centroids, classes = compute_centroids(________)  # Fill the missing term

y_pred = predict_centroids(centroids, classes, X_test)

print("Accuracy:", accuracy_score(y_test, y_pred))

What should replace the blank ________ to correctly compute the centroids?

0%
0%
100%
0%
More questions like this

Want instant access to all verified answers on moodle.nu.edu.kz?

Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!

Browser

Add to Chrome