Compute the silhouette score of a single point. intra holds the distances from the point to the other members of its own cluster, and nearest holds the average distances from the point to each of the other clusters. With a = mean of intra and b = smallest value in nearest, the score is (b−a)/max(a,b), or 0 when both are zero.
Implement solve(intra, nearest).
Returns. Return a float in [−1,1]. intra and nearest must not be empty.
Example 1
Input:
solve([1.0, 2.0], [5.0, 7.0])
Output:
0.7
Example 2
Input:
solve([4.0], [2.0])
Output:
-0.5
Example 3
Input:
solve([0.0], [0.0])
Output:
0.0
No results yet
Run your code to check it against the examples, or submit to run every test.