-
Notifications
You must be signed in to change notification settings - Fork 1
/
step1_choose_center.py
27 lines (22 loc) · 1.12 KB
/
step1_choose_center.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
from plot import *
from cluster import DensityPeakCluster, load_paper_data
def plot(data, auto_select_dc=False):
# logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', level=logging.INFO)
dp_cluster = DensityPeakCluster()
# calculate local density
distances, max_dis, min_dis, max_id, rho, rc = dp_cluster.local_density(load_paper_data, data,
auto_select_dc=auto_select_dc)
# calculate delta, minimum distance
delta, nearest_neigh = min_distance(max_id, max_dis, distances, rho)
# plot to choose the threshold
plot_rho_delta(rho, delta)
if __name__ == '__main__':
# plot('./data/data_in_paper/example_distances.dat')
# plot('./data/data_others/spiral_distance.dat')
# plot('./data/data_others/aggregation_distance.dat')
# plot('./data/data_others/flame_distance.dat')
# plot('./data/data_others/jain_distance.dat')
plot('./data/spam_mail_data/spam_distance_1000.dat', False)
# plot('./data/data_others/aggregation_cosine_distance.dat', False)