从sklearn EllipticEnvelope获取异常值的索引
我正在尝试获取离群值的索引,但我无法做到
features, _= make_blobs(n_samples=100, centers=1, n_features=3)
#update a few elements with large int:
features[0,0] = 10000
features[0,1] = 10000
features[20,0] = 1000
features[20,1] = 8000
features[30,1] = 2000
dataset =
pd.DataFrame({'Column1':features[:,0],'Column2':features[:,1],'Column3':features[:,2]})
outlier_detector = EllipticEnvelope(contamination=.1)
outlier_detector.fit(dataset)
outlier_detector.predict((dataset))
我尝试了dataset.index,但是尽管使用了reshape(),它仍然告诉我“期望的2D数组,得到了1D数组”
有人有什么想法吗? 谢谢