VOOZH about

URL: https://www.geeksforgeeks.org/python/calculating-the-completeness-score-using-sklearn-in-python/

⇱ Calculating the completeness score using sklearn in Python - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Calculating the completeness score using sklearn in Python

Last Updated : 26 May, 2021

An entirely complete clustering is one where each cluster has information that directs a place toward a similar class cluster. Completeness portrays the closeness of the clustering algorithm to this (completeness_score) perfection. 

This metric is autonomous of the outright values of the labels. A permutation of the cluster label values won't change the score value in any way.

sklearn.metrics.completeness_score()

Syntax: sklearn.metrics.completeness_score(labels_true, labels_pred)

Parameters:

  • labels_true:<int array, shape = [n_samples]>: It accepts the ground truth class labels to be used as a reference.
  • labels_pred: <array-like of shape (n_samples,)>: It accepts the cluster labels to evaluate.

Returns: completeness score between 0.0 and 1.0. 1.0 stands for perfectly completeness labeling.

Switching label_true with label_pred will return the homogeneity_score.

Example 1:

Output:

0.8471148027985769

Example 2: Perfectly completeness:

 
Output: 

1.0 

Example 3: Non-perfect labeling that further split classes into more clusters can be perfectly completeness:

Output:

0.9999999999999999

Example 4: Include samples from different classes don't make for completeness labeling:

Output:

0.0


 

Comment
Article Tags: