Centers of the Groups
The rows of X are points that fall into k well separated groups, and nobody has labeled them. Find the groups with k-means (n_init=10, random_state=0) and return the group centers, sorted by their first coordinate. Answers within 0.01% are accepted.
Example 1
X [[0,0],[0,2],[2,0],[2,2],[10,10],[10,12],[12,10],[12,12]]
k 2
returns [[1.0,1.0],[11.0,11.0]]
Four points around (1, 1) and four around (11, 11).
Constraints
2 <= k <= 4len(X) <= 60, 2 columns
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.
More scikit-learn problems
- Column That Matters MostMedium
- How Well It RanksMedium
- No PeekingMedium
- Scale Then VoteMedium
- Shrunken SlopesMedium
- Two Main DirectionsMedium
- Words to CountsMedium
- How Many GroupsHard