Cluster Plot

Plots of vectors, colour coordinated by their cluster labels can be used to visually evaluate the success of clustering. Dimension reduction to 3D is applied to the vector field before plotting. The number of dimensions (3) is chosen to be as large as possible to preserve as much information of the original vector space as possible while being able to visualise on a plot. Optionally, a ground truth field can also be provided, for which, the vectors, colour coordinated by the ground truth label will also be plotted on the side for comparison.

Code Example

The following code plots a 3D dimension reduced version of the vectors, colour coded by clusters, also the ground truth (i.e. an optional argument).

DATASET_ID = "quickstart_clustering"
VECTOR_FIELD = "descriptiontextmulti_vector_"
GROUND_TRUTH_FIELD = "category"

client.vector_tools.cluster.plot(
  dataset_id = DATASET_ID, 
  vector_field = VECTOR_FIELD, 
  cluster_alias = "kmeans_10", 
  ground_truth_field = GROUND_TRUTH_FIELD
)

Did this page help you?