ValueError Traceback (most recent call last)
in
3
4 # Find closest centroids using initial_centroids
----> 5 idx = find_closest_centroids(X, initial_centroids)
6
7 # Print closest centroids for the first three elements
in find_closest_centroids(X, centroids)
25 distance =
26 for j in range(centroids.shape[0]):
β> 27 norm_ij = np.linalg.norm(X[i], centroids[j])
28 distance.append(norm_ij)
29
<array_function internals> in norm(*args, **kwargs)
/opt/conda/lib/python3.7/site-packages/numpy/linalg/linalg.py in norm(x, ord, axis, keepdims)
2468 if ((ord is None) or
2469 (ord in (βfβ, βfroβ) and ndim == 2) or
β 2470 (ord == 2 and ndim == 1)):
2471
2472 x = x.ravel(order=βKβ)
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()