Double scalars error
levantail opened this issue · 0 comments
levantail commented
Hello,
i've tried to run your snippet but have a problem with double_scalars, it appears in next cell in jupyter notebook:
error_rates = {x:None for x in range(5,25)+[100]}
for k in range(5,25):
trained_clusters, trained_centroids = cluster(training, k)
labelled_centroids = assign_labels_to_centroids(trained_clusters, trained_centroids)
error_rate = get_error_rate(validation, labelled_centroids)
error_rates[k] = error_rate
# Show the error rates
x_axis = sorted(error_rates.keys())
y_axis = [error_rates[key] for key in x_axis]
plt.figure()
plt.title("Error Rate by Number of Clusters")
plt.scatter(x_axis, y_axis)
plt.xlabel("Number of Clusters")
plt.ylabel("Error Rate")
plt.show()
and error code is:
ipykernel_launcher.py:52: RuntimeWarning: invalid value encountered in double_scalars