#NEWLINE# @ classmethod #NEWLINE# def A_k( cls , clustering , D , matrix ) : #NEWLINE# #INDENT# '\n        Calculates the A_k term.\n        :param clustering: The clustering being checked.\n        :param matrix: The condensed matrix containing all distances.\n        :return: The A_k term value.\n        ' #NEWLINE# n = n . total_number_of_elements #NEWLINE# k = len ( clustering . clusters ) #NEWLINE# return ( ( 1.0 / ( n - k ) ) * numpy . array ( [ cls . ch_cluster_term ( cluster , D , matrix ) for cluster in clustering . clusters ] ) . sum ( ) )