사기 데이터의 토픽 모델링

Python으로 배우는 사기 탐지

Charlotte Werger

Data Scientist

토픽 모델링: 텍스트의 숨은 패턴 발견

  1. 텍스트 데이터에서 토픽 찾기
  2. “텍스트는 무엇에 관한가”
  3. 개념적으로 군집화와 유사
  4. 사기 vs 비사기 사례의 토픽을 비교해 특성/플래그로 사용
  5. 또는 데이터에 사기를 시사하는 특정 토픽이 있는가?
Python으로 배우는 사기 탐지

잠재 디리클레 할당(LDA)

LDA로 얻는 것:

  1. “텍스트별 토픽” 모델(확률)
  2. “토픽별 단어” 모델

직접 토픽 모델 만들기:

  1. 데이터 정제
  2. 사전과 코퍼스로 Bag-of-Words 생성
  3. 사전과 코퍼스를 LDA 모델에 입력
Python으로 배우는 사기 탐지

잠재 디리클레 할당(LDA)

Python으로 배우는 사기 탐지

Bag-of-Words: 사전과 코퍼스

from gensim import corpora
# Create dictionary number of times a word appears
dictionary = corpora.Dictionary(cleaned_emails)
# Filter out (non)frequent words 
dictionary.filter_extremes(no_below=5, keep_n=50000)
# Create corpus
corpus = [dictionary.doc2bow(text) for text in cleaned_emails]
Python으로 배우는 사기 탐지

gensim으로 LDA 수행

import gensim
# Define the LDA model
ldamodel = gensim.models.ldamodel.LdaModel(corpus, num_topics = 3, 
id2word=dictionary, passes=15)
# Print the three topics from the model with top words
topics = ldamodel.print_topics(num_words=4)
for topic in topics:
    print(topic)
(0, 0.029*"email" + 0.016*"send" + 0.016*"results" + 0.016*"invoice")
(1, 0.026*"price" + 0.026*"work" + 0.026*"management" + 0.026*"sell")
(2, 0.029*"distribute" + 0.029*"contact" + 0.016*"supply" + 0.016*"fast")
Python으로 배우는 사기 탐지

연습해 봅시다!

Python으로 배우는 사기 탐지

Preparing Video For Download...