基于距离的噪声检测
代码
from numpy
import *
import numpy
as np
s1
=np
.array
([1,2,0])
s2
=np
.array
([3,1,4])
s3
=np
.array
([2,1,5])
s4
=np
.array
([0,1,6])
s5
=np
.array
([2,4,3])
s6
=np
.array
([4,4,2])
s
=np
.array
([s1
,s2
,s3
,s4
,s5
,s6
])
def ed(m
, n
):
return np
.sqrt
(np
.sum((m
- n
) ** 2))
i
=0
for i
in range(len(s
)):
j
,k
=0,0
for j
in range(len(s
)):
distance
=float(format(ed
(s
[i
],s
[j
]),'.3f'))
if distance
>4:
k
=k
+1
j
=j
+1
i
=i
+1
if k
>2:
print("可选择S",i
,"作为噪声数据")
** 运行结果**
转载请注明原文地址:https://blackberry.8miu.com/read-6798.html