새소식

Machine Learning

[머신러닝] 이상치 탐지(anomaly detection) #01

  • -
728x90
이 포스트는 고려대학교 강필성 교수님의 강의 내용과, 따로 학습한 내용을 정리를 한 것입니다.

이상치에 대한 정의

1. 데이터 생성 매커니즘 관점
 Observation that deviate so much from other observations as to arouse suspicions that they were generated by a different mechanims

2. 데이터 분포에서 밀도에 관한 관점
 Instances that thier true probability destiny is very low ⇒ 동일한 매커니즘으로 생성 됐을 필요 X

Synonyms

Anomaly 조금 부정적인 뉘앙스의 이상치
Novelty 다변량 데이터, 긍정적인 뉘앙스
Outlier 단변량 데이터에서 변수들의 범위를 극단적으로 벗어나는 데이터

 

Outlier & Noise Data

Outlier: 우리가 찾아야하는 흥미로운 상황

Noise Data:
- Random error or variance in a measured variable
- 데이터 수집과정에서 자연 발생하는 변동성
- 수집과정에서 완전히 배제할 수 없으며 어느정도 안고가야한다.

It violates the mechanism that generates the nomal data

Classification vs Anomaly Detection

어떻게 구분하는가?
1. 주어진 데이터에 다수의 정상 데이터와 매우 적은 수의 비정상 데이터가 혼재 되어있음
2. 소수 범주에 대한 예시가 충분하지 않음
=> 이상치 탐지

Generalization and Specialization

둘은 trade-off 관계
  • 일반화: 주어진 데이터로부터 정상 범주의 개념을 확장해 가는 것
  • 특수화: 주어진 데이터로부터 정상 범주의 개념을 좁혀 가는 것
  • 적절히 조절하지 않으면 1종 오류, 2종 오류 발생

1종 오류: 귀무가설이 참임에도 귀무가설을 기각함으로써 발생되는 오류
2종 오류: 귀무가설이 거짓임에도 불구하고 귀무가설을 채택함으로써 발생되는 오류

이상치 탐지 데이터 셋 구성시 유의사항

1. 학습 데이터에는 정상 범주 데이터만 포함
2. Validation data나 Test data에는 이상치 데이터가 최대한 균등하게 포함되어야 한다.
=> how to? Stratified k-fold cross validation

Type of Abnomal data

  • Global outlier
    • object that significantly deviates from the rest of that the data set
      • Credit card, fraud detection
    • Issue: find an appropriate measurement of deviation
  • Contextual outlier(local outlier)
    • object that deviates significantly based on a selected context
      • 30℃ in Alaska VS 30℃ in Sahara
    • Issue: How to define or formulate meaningful context?
  • Collective outlier
    • A subset of data objects collectively deviate from the whole data set, individual data objects may not be outliers
      • Denial - of Service (DoS) attack

Performance Measures

  • 이상치 알고리즘에 대한 결과물이 산출되면 이를 바탕으로 최종적으로는 이상치인지 아닌지에 대한 판별을 해야 함
  • 실제 데이터에서는 이러한 cut-off에 따라 정오 행렬이 달라지기 때문에 이상치 탐지 방법론의 성능 역시 달라진다.
  • 따라서 이상치 탐지 방법론 자체의 정합성을 평가할 때는 cut-off에 영향을 받지 않는 성능 평가 지표가 필요함.

  • False Rejection Rate(FRR): True인 데이터를 False로 판별할 확률
  • False Acceptance Rate(FAR): False인 데이터를 True로 판별할 확률

Description statistic

a way to quantitatively describe a feature in a data set using summary statistics.
  • 전통적인 기술 통계적인 관점에서 본 이상치.
  • 대표적으로 the use of inetquartile ranges(IQRs) 이용
  • single shape or patten에는 좋은 결과를 보여주지만 diffetent types of shapes or group에는 성능이 떨어졌다.
  • IQR is the difference between Q3 and Q1
    • Q1: the value where 25% of the data
    • Q2(중앙값): the value where 50% of the data
    • Q3: the value where 75% of the data
  • IQR to detect outlier는 1.5*IQR rules라고 불린다.
    • 이걸 이용해 이상치를 탐지할 때 사용할 수 있는 상한과 하한을 계산한다.
  1. caculate upper bound: Q3+1.5*IQR
  2. caculate lower bound: Q1-1.5*IQR
  3. caculate outliers by removing any value less than the lower bound or greater than the upper bound.

Clustering

a set of unsupervised machine learning algorithms that group objects in a data set together such that similar objects are in the same group
  • 비지도 학습의 대표적인 방법. 비슷한 object들을 같은 그룹으로 묶는다.
  • 대표적으로 DBSCAN(밀도 기반 클러스터링) 사용
  • works: by looking for clusters such that the points in each one are desely/tightly packed together

참고

728x90
Contents

포스팅 주소를 복사했습니다

이 글이 도움이 되었다면 공감 부탁드립니다.