Topic modeling กับการฉ้อโกง

การตรวจจับการฉ้อโกงด้วย Python

Charlotte Werger

Data Scientist

Topic modeling: ค้นพบรูปแบบที่ซ่อนอยู่ในข้อมูลข้อความ

  1. ค้นหาหัวข้อในข้อมูลข้อความ
  2. "ข้อความนี้พูดถึงอะไร"
  3. คล้ายกับการทำ clustering ในเชิงแนวคิด
  4. เปรียบเทียบหัวข้อของคดีฉ้อโกงกับคดีที่ไม่ฉ้อโกง เพื่อใช้เป็น feature หรือ flag
  5. หรือ.. มีหัวข้อใดในข้อมูลที่ชี้ไปยังการฉ้อโกงหรือไม่?
การตรวจจับการฉ้อโกงด้วย Python

Latent Dirichlet Allocation (LDA)

ผลลัพธ์จาก LDA:

  1. โมเดล "หัวข้อต่อรายการข้อความ" (ค่าความน่าจะเป็น)
  2. โมเดล "คำต่อหัวข้อ"

ขั้นตอนสร้าง topic model:

  1. ทำความสะอาดข้อมูล
  2. สร้าง bag of words ด้วย dictionary และ corpus
  3. ป้อน dictionary และ corpus เข้าโมเดล LDA
การตรวจจับการฉ้อโกงด้วย Python

Latent Dirichlet Allocation (LDA)

การตรวจจับการฉ้อโกงด้วย Python

Bag of words: dictionary และ corpus

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

Latent Dirichlet Allocation (LDA) ด้วย gensim

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...