def calculate_clarans_cvi(data, initial_cluster, dist=None):
    cvi_df = pd.DataFrame(columns=['avg_inter_dist', 'silhouette', 'calinski', 'avg_intra_dist', 'davies', 'dunn'])
    df_list = data.values.tolist()
    dist = pairwise_distances(data)
    np.fill_diagonal(dist, 0)
    for k in range(initial_cluster, 10):
        print(k)
        clarans_model = clarans(df_list, k, 3, 5)
        (_, result) = timedcall(clarans_model.process)
        labels = clarans_labels(result)
        sihlouette = silhouette_score(dist=dist, labels=labels)
        davies = davies_bouldin_score(data, labels)
        calinski = calinski_harabasz_score(data, labels)
        dunn_ = dunn(dist, labels)
        cvi_df.loc[k] = [avg_inter_dist, sihlouette, davies, calinski, avg_intra_dist, dunn_]
        print(cvi_df)
        del clarans_model
    return cvi_df
def calculate_clarans_cvi(data, initial_cluster, dist=None):
    cvi_df = pd.DataFrame(columns=['avg_inter_dist', 'silhouette', 'calinski', 'avg_intra_dist', 'davies', 'dunn'])
    df_list = data.values.tolist()
    dist = pairwise_distances(data)
    np.fill_diagonal(dist, 0)
    for k in range(initial_cluster, 10):
        print(k)
        clarans_model = clarans(df_list, k, 3, 5)
        (_, result) = timedcall(clarans_model.process)
        labels = clarans_labels(result)
        sihlouette = silhouette_score(dist=dist, labels=labels)
        davies = davies_bouldin_score(data, labels)
        calinski = calinski_harabasz_score(data, labels)
        dunn_ = dunn(dist, labels)
        cvi_df.loc[k] = [avg_inter_dist, sihlouette, davies, calinski, avg_intra_dist, dunn_]
        print(cvi_df)
        del clarans_model
    return cvi_df