기타 클러스터링 기반 이상 거래 탐지 방법

Python으로 배우는 사기 탐지

Charlotte Werger

Data Scientist

클러스터링 방법은 다양합니다

Python으로 배우는 사기 탐지

사기를 표시하는 다른 방법: 가장 작은 클러스터 사용

Python으로 배우는 사기 탐지

실제 데이터는 이렇게 보입니다

Python으로 배우는 사기 탐지

DBSCAN vs. K-means

  • 클러스터 수를 미리 정할 필요 없음
  • 클러스터 내 점들 간 최대 거리 조정
  • 클러스터의 최소 샘플 수 지정
  • 비정형 형태 데이터에 강함
  • 단, 계산 비용 증가
Python으로 배우는 사기 탐지

DBSCAN 구현

from sklearn.cluster import DBSCAN
db = DBSCAN(eps=0.5, min_samples=10, n_jobs=-1).fit(X_scaled)

# Get the cluster labels (aka numbers) pred_labels = db.labels_
# Count the total number of clusters n_clusters_ = len(set(pred_labels)) - (1 if -1 in pred_labels else 0) # Print model results print('Estimated number of clusters: %d' % n_clusters_)
Estimated number of clusters: 31
Python으로 배우는 사기 탐지

클러스터 크기 점검

# Print model results
print("Silhouette Coefficient: %0.3f" % metrics.silhouette_score(X_scaled, pred_labels))
Silhouette Coefficient: 0.359
# Get sample counts in each cluster 
counts = np.bincount(pred_labels[pred_labels>=0])
print (counts)
[ 763  496  840  355 1086  676   63  306  560  134   28   18  262  128  332  22  
   22   13   31   38   36   28   14   12   30   10   11   10   21   10    5]
Python으로 배우는 사기 탐지

Let's practice!

Python으로 배우는 사기 탐지

Preparing Video For Download...