@@ -23,6 +23,7 @@ def __init__(self,
2323 distance_metric = 'euclidean' ,
2424 k = 3 ,
2525 gauss_cutoff = True ,
26+ percent = 2.0 ,
2627 density_threshold = None ,
2728 distance_threshold = None ,
2829 anormal = True ,
@@ -34,6 +35,7 @@ def __init__(self,
3435 self .distance_metric = distance_metric
3536 self .k = k
3637 self .gauss_cutoff = gauss_cutoff
38+ self .percent = percent
3739 self .density_threshold = density_threshold
3840 self .distance_threshold = distance_threshold
3941 self .anormal = anormal
@@ -97,8 +99,7 @@ def __select_dc(self):
9799 if self .dc == 'auto' :
98100 dc = self .__auto_select_dc ()
99101 else :
100- percent = 2.0
101- position = int (self .n_id * (self .n_id + 1 ) / 2 * percent / 100 )
102+ position = int (self .n_id * (self .n_id + 1 ) / 2 * self .percent / 100 )
102103 dc = np .sort (list (self .distances .values ()))[
103104 position * 2 + self .n_id ]
104105
@@ -110,9 +111,9 @@ def __local_density(self):
110111
111112 :return: local density vector that index is the point index
112113 """
113- guass_func = lambda dij , dc : math .exp (- (dij / dc ) ** 2 )
114+ gauss_func = lambda dij , dc : math .exp (- (dij / dc ) ** 2 )
114115 cutoff_func = lambda dij , dc : 1 if dij < dc else 0
115- func = guass_func if self .gauss_cutoff else cutoff_func
116+ func = gauss_func if self .gauss_cutoff else cutoff_func
116117 rho = [0 ] * self .n_id
117118 for i in range (self .n_id ):
118119 for j in range (i + 1 , self .n_id ):
0 commit comments