Skip to content
C

Problem 2: Apply Agglomerative Clustering with a Fixed Number of Clusters

Easypython

Problem Description

Write a Python program that applies AgglomerativeClustering with n_clusters=2 to a dataset, and prints the resulting cluster assignments.

Input

A 2D dataset with two visually distinct groups.

Output

The cluster label for each point.

Constraints

  • At least 6 points.

Example Input

text
[[1,1],[2,2],[2,3],[8,8],[9,8],[8,9]]

Example Output

text
Cluster assignments: [0 0 0 1 1 1]

Concepts Covered

AgglomerativeClustering, .fit_predict().

Input (stdin)

Output

Run your code to see output here...