Skip to content
C

Problem 3: Print Centroid Locations and Inertia

Easypython

Problem Description

Write a Python program that fits a K-Means model with k=3 to a dataset and prints the final centroid locations and total inertia.

Input

A dataset with 3 visually distinct groups.

Output

The centroid locations and inertia value.

Constraints

  • At least 9 data points.

Example Input

text
(9 points forming 3 visually distinct groups)

Example Output

text
Centroids: [[...], [...], [...]] Inertia: 12.5

Concepts Covered

.cluster_centers_, .inertia_.

Input (stdin)

Output

Run your code to see output here...