def _getPrototypes(indices, overlaps, topNumber=1):
    """
    Given a compressed overlap array and a set of indices specifying a subset
    of those in that array, return the set of topNumber indices of vectors that
    have maximum average overlap with other vectors in `indices`.

    @param indices (arraylike) Array of indices for which to get prototypes.

    @param overlaps (numpy.ndarray) Condensed array of overlaps of the form
        returned by _computeOverlaps().

    @param topNumber (int) The number of prototypes to return. Optional,
        defaults to 1.

    @returns (numpy.ndarray) Array of indices of prototypes
    """
    # find the number of data points based on the length of the overlap array
    # solves for n: len(overlaps) = n(n-1)/2
    n = numpy.roots([1, -1, -2 * len(overlaps)]).max()
    k = len(indices)

    indices = numpy.array(indices, dtype=int)
    rowIdxs = numpy.ndarray((k, k-1), dtype=int)
    colIdxs = numpy.ndarray((k, k-1), dtype=int)

    for i in xrange(k):
      rowIdxs[i, :] = indices[i]
      colIdxs[i, :i] = indices[:i]
      colIdxs[i, i:] = indices[i+1:]

    idx = HierarchicalClustering._condensedIndex(rowIdxs, colIdxs, n)
    subsampledOverlaps = overlaps[idx]

    meanSubsampledOverlaps = subsampledOverlaps.mean(1)
    biggestOverlapSubsetIdxs = numpy.argsort(
      -meanSubsampledOverlaps)[:topNumber]

    return indices[biggestOverlapSubsetIdxs]
def _getPrototypes ( indices , overlaps , topNumber = 1 ) : n = numpy . roots ( [ 1 , - 1 , - 2 * len ( overlaps ) ] ) . max ( ) k = len ( indices ) indices = numpy . array ( indices , dtype = int ) rowIdxs = numpy . ndarray ( ( k , k - 1 ) , dtype = int ) colIdxs = numpy . ndarray ( ( k , k - 1 ) , dtype = int ) for i in xrange ( k ) : rowIdxs [ i , : ] = indices [ i ] colIdxs [ i , : i ] = indices [ : i ] colIdxs [ i , i : ] = indices [ i + 1 : ] idx = HierarchicalClustering . _condensedIndex ( rowIdxs , colIdxs , n ) subsampledOverlaps = overlaps [ idx ] meanSubsampledOverlaps = subsampledOverlaps . mean ( 1 ) biggestOverlapSubsetIdxs = numpy . argsort ( - meanSubsampledOverlaps ) [ : topNumber ] return indices [ biggestOverlapSubsetIdxs ]
Given a compressed overlap array and a set of indices specifying a subset
    of those in that array, return the set of topNumber indices of vectors that
    have maximum average overlap with other vectors in `indices`.

    @param indices (arraylike) Array of indices for which to get prototypes.

    @param overlaps (numpy.ndarray) Condensed array of overlaps of the form
        returned by _computeOverlaps().

    @param topNumber (int) The number of prototypes to return. Optional,
        defaults to 1.

    @returns (numpy.ndarray) Array of indices of prototypes