(data, metric, k=5)
return kth_dist
The function computes the epsilon parameter for DBSCAN through method
    proposed in the paper.
    Parameters
    ----------
    data : Orange.data.Table
        Visualisation coordinates - embeddings
    metric : callable or str
        The metric to compute the distance.
    k : int
        Number kth observed neighbour

    Returns
    -------
    np.ndarray
        Epsilon parameter for DBSCAN
The function computes the epsilon parameter for DBSCAN through method
    proposed in the paper.
    Parameters
    ----------
    data : Orange.data.Table
        Visualisation coordinates - embeddings
    metric : callable or str
        The metric to compute the distance.
    k : int
        Number kth observed neighbour
The function computes the epsilon parameter for DBSCAN through method proposed in the paper . Parameters ---------- data : Orange . data . Table Visualisation coordinates - embeddings metric : callable or str The metric to compute the distance . k : int Number kth observed neighbour
def get_kth_distances(data, metric, k=5):
    """
    The function computes the epsilon parameter for DBSCAN through method
    proposed in the paper.
    Parameters
    ----------
    data : Orange.data.Table
        Visualisation coordinates - embeddings
    metric : callable or str
        The metric to compute the distance.
    k : int
        Number kth observed neighbour

    Returns
    -------
    np.ndarray
        Epsilon parameter for DBSCAN
    """
    x = data.X
    if x.shape[0] > 1000:  # subsample
        x = x[np.random.randint(x.shape[0], size=1000), :]

    dist = pairwise_distances(x, metric=metric)
    k = min(k+1, len(data) - 1)  # k+1 since first one is item itself
    kth_point = np.argpartition(dist, k, axis=1)[:, k]
    kth_dist = np.sort(dist[np.arange(0, len(kth_point)), kth_point])[::-1]

    return kth_dist
def get_kth_distances ( data , metric , k = 5 ) : x = data . X if x . shape [ 0 ] > 1000 : # subsample x = x [ np . random . randint ( x . shape [ 0 ] , size = 1000 ) , : ] dist = pairwise_distances ( x , metric = metric ) k = min ( k + 1 , len ( data ) - 1 ) # k+1 since first one is item itself kth_point = np . argpartition ( dist , k , axis = 1 ) [ : , k ] kth_dist = np . sort ( dist [ np . arange ( 0 , len ( kth_point ) ) , kth_point ] ) [ : : - 1 ] return kth_dist