SlideShare a Scribd company logo
1 of 70
Download to read offline
- About Me -
Topic
1.โจทย์ทาง Business เกี่ยวกับ Fraud Detection
3.Fraud Detection Rule-Based or Model-Based?
2.การทา Fraud Detection มีกี่วิธี?
4.ขั้นตอน Data Analytics for Fraud Detection (Model-Based)
5. Fraud Detection Model Important
6.Demo Build a Fraud Detection Model With Python in Google Colab
1.โจทย์ทาง Business เกี่ยวกับ Fraud Detection
Fraud Scenario Process
Authentication
(ก่อนเกิดเหตุ)
Detection
(ขณะเกิดเหตุ)
Investigation
(หลังเกิดเหตุ)
Verification
Accountability
Log File Example
1.โจทย์ทาง Business เกี่ยวกับ Fraud Detection
ใช้ RFM Model คานวณ Error ของ Fraud Detection
ที่ยอมรับได้ และจานวนเงินที่ยอมสูญเสียได้ โดยใช้ข้อมูลในอดีต
ก่อนจะวางกลยุทธ์ Fraud Detection ในปัจจุบัน
R = Recency = ครั้งล่าสุดเมื่อไหร่
F = Frequency = ความถี่เท่าไหร่
M = Monetary = จานวนเงินเท่าไหร่
1.โจทย์ทาง Business เกี่ยวกับ Fraud Detection
เช่น ปี 63 มีจานวนธุรกรรมในองค์กรทั้งหมด 1,000,000 ครั้ง
เป็น Fraud จานวน 1,000 เคส
สูญเสียเงินรวมจานวน 10 ล้านบาท (เฉลี่ย 1 หมื่นบาท/เคส)
เป็น False Positive หรือ False Reject (ผู้ใช้งานตัวจริง ใช้งานไม่ได้ เพราะถูก Detect ว่าเป็น Fraud)
จานวน 5,000 ครั้ง มี User ยกเลิกบริการ จานวน 1,000 ราย
องค์กรสูญเสียรายรับที่ควรได้ จานวน 1 ล้านบาท
เป็น False Negative หรือ False Accept (ผู้ร้ายเข้าใช้งาน ระบบกลับปล่อยผ่าน ไม่ Detect ว่าเป็น Fraud)
จานวน 1,000 ครั้ง องค์กรสูญเสียรายได้ จานวน 10 ล้านบาท
ดังนั้น ควรให้น้าหนักระบบ Fraud Detection ปัจจุบัน ไปทางลด False Accept
มากกว่า ลด False Reject เป็นต้น
2.การทา Fraud Detection มีกี่วิธี?
Fraud เกิดจากผู้โจมตีที่เป็นมนุษย์
การทา Fraud Detection ต้องปรับรูปแบบการ Detect อยู่ตลอด
ดังนั้น ไม่ว่าจะ Detect ด้วยวิธีใด
2) Model-Based Detection (เรียนรู้จาก Dataset ในอดีต)
1) Rule-Based Detection (กาหนดเกณฑ์ Fraud ลักษณะ If Then Else)
3) Outlier Detection (พฤติกรรมการใช้งานที่ผิดปกติ)
หาก Detect Fraud ได้ผล ก็นามาปรับใช้ได้ทั้งสิ้น
Rule-Based Example
Sample New Registration Rule:
If IP_Address_Location == [‘Japan’] and
Cust_Address_Country = [‘USA’] and
CUSTOMER_PHONE_LOC == [‘Spain’] THEN Investigate
Rule-Based Fraud Detection Example
Rule-Based = Predict Base on Rule
Model-Based = Predict Base on Probability
เปลี่ยนจาก การนาความรู้ของ Domain Expert
(ผู้เชี่ยวชาญ) ที่ให้โปรแกรมเมอร์ เขียนคาสั่ง
Program ลักษณะ If Then Else
มาเป็น การสร้างโมเดล จากชุดข้อมูล ที่มี Attribute
(คุณลักษณะ) กับ Label (ผลลัพท์) เพื่อให้
Program แสดง Output จากโมเดล ที่ได้เรียนรู้
จากชุดข้อมูลนั้น (กรณี Model Base Detection)
Dataset Algorithm Model
Size (ตารางฟุต) Bedrooms Bathrooms Price
500 2 2 400K
1,000 3 2 600K
1,500 4 1 700K
2,000 4 2 750K
2,000 4 1 740K
3,000 5 2 800K
Example: Predicting Real Estate Price
Price = 0.3(Size) + 0.2(Bedroom) + 0.001(Bathrooms)
ตัวอย่าง Dataset ของ Credit Card Fraud Detection
3.พิจารณาเลือก Fraud Detection
โดยใช้ Rule-Based หรือ Model-Based ดี?
4.ขั้นตอน Data Analytics for Fraud Detection (Model-Based)
1)กาหนดโจทย์ปัญหาทาง Business (ตั้งคาถามที่ถูกต้อง)
2)เก็บรวบรวมข้อมูล (Data Warehouse , Data Lake , Data Engineer)
5)Evaluate วัดผล Model พร้อมปรับจูนแก้ไข Model
3)ทาความสะอาดข้อมูล (Data Cleansing) และสร้างกราฟ (Visualization)
4)นาชุดข้อมูล ทดสอบกับ Algorithm เพื่อสร้าง Model
6)นา Model Deploy ใช้งานจริง
1)กาหนดโจทย์ปัญหาทาง Business ตั้งคาถามที่ถูกต้อง
- Fraud Detection
- Sentiment Analysis
- Facial Recognition
- Churn Prediction
- Customize Segmentation
- Product Recommendation
(โจทย์ Regression , Classification หรือ Clustering)
2)เก็บรวบรวมข้อมูล
(Data Warehouse , Data Lake , Data Engineer)
Branch
ATM
Internet Banking
Mobile Banking
Data Warehouse
Data Lake
Data Analyst
Data Scientist
Dashboard
Build Model
Action
Data Source
ส่วนเก็บข้อมูล ส่วนวิเคราะห์ข้อมูล
Source: https://towardsdatascience.com/build-your-first-data-warehouse-with-airflow-on-gcp-fdd0c0ad91bb
3)ทาความสะอาดข้อมูล (Data Cleansing)
รวมถึง การทาข้อมูลให้เป็นรูปภาพ (Visualization)
- ทาความสะอาด เชิงโครงสร้างข้อมูลทั่วไป
- ทาความสะอาด เชิงก่อนนาเข้า Build Model
เช่น ค่า Missing , N/A , Outlier , พิมพ์ผิด เป็นต้น
กรณี Dataset ลักษณะ Imbalance ไม่สมดุล
คือ ข้อมูลที่ต้องการทานาย มีจานวนน้อย เทียบกับข้อมูลทั้งหมด เช่น
การทา Fraud Detection , Churn Prediction
จะมีเทคนิค Undersampling , Oversampling เพื่อแก้ปัญหา
ตัวอย่าง Data Dirty
Photo Source: https://riccosmartdata.com/data-cleansing-or-data-cleaning
4)นาชุดข้อมูล ทดสอบกับ Algorithm เพื่อสร้าง Model
Machine Learning คืออะไร?
Machine Learning
Input Program
Output
Input Program
Output
X(input)
Y(output)
1
1
2
4
3
9
4
16
5
25
6
?
X
2
= Model
Source: https://light-it.net/blog/top-10-python-libraries-for-machine-learning
Dataset Algorithm Model
Machine Learning Model
• Custom Algorithm
• Automl
• Pre-trained Model
Machine Learning
• Supervised Learning (Predictive)
• Unsupervised Learning (Descriptive)
• Reinforcement Learning (Learn by Reward and Penalty)
Photo Source : www.researchgate.net
Outlier Detection
5)Evaluate วัดผล Model พร้อมปรับจูนแก้ไข Model
(โจทย์ Regression , Classification หรือ Clustering)
Mean Absolute Percentage Error (MAPE)
Mean Absolute Error (MAE)
การวัดผลโจทย์ Regression
โจทย์ที่มีค่า Label (ค่า Y) เป็นลักษณะ Continuous (ตัวเลข)
ตัวอย่างการวัดผลโจทย์ Regression
โจทย์ที่มีค่า Label (ค่า Y)
ลักษณะจาแนกว่าเป็น Class ไหน
การวัดผลโจทย์
Classification
ROC & AUC
ที่มา: https://qastack.in.th/stats/225210/accuracy-vs-area-under-the-roc-curve
Source: www.oreilly.com
การวัดผลโจทย์ Clustering วัดว่าควรจะแบ่งเป็นกี่กลุ่ม (ใช้ K กี่ตัว)
6)นา Model Deploy ใช้งานจริง
- Embed
- Push
- Dashboard
6)นา Model Deploy ใช้งานจริง
นา Model ที่ Build ได้ ออกมาเป็นไฟล์ การ Deploy
ใช้ลักษณะ เรียก API (Application Programming
Interface) ของโปรแกรมที่ใช้งาน มายัง Model
1) Imbalance Dataset
2) Confusion Matrix Evaluate Model
3) ROC & AUC Curve
4) Weight Model to False Reject & False Accept
5) Improve Process of Authentication & Investigation
5.Fraud Detection Model Important
“Bad actors change tactics often”
2) ลด False Reject กรณี ผู้ใช้งานตัวจริง เข้าใช้งานไม่ได้ มักแจ้งมาทาง
Call Center โดยเร็ว ดังนั้น รีบรับเคส False Reject จาก Call Center
(หรือช่องทางอื่น) เพื่อปรับปรุงระบบ Fraud Detection
ควรจา 3 ข้อ สาหรับ Fraud Detection
1) Fraud เกิดจากมนุษย์ รูปแบบการโจมตี เปลี่ยนได้ตลอด ดังนั้น ระบบตรวจจับ ต้องยืดหยุ่น
เพื่อให้ตรวจจับได้อย่างทันท่วงที ไม่ว่าจะเป็นการปรับ Rule Base ของระบบตรวจจับ หรือ
การใช้ Data ของ Fraud ในอดีต เพื่อสร้าง Model ตรวจจับ ก็ตาม (ต้องปรับได้ทั้ง Rule
Base Model Base และ Outlier Base)
3) ลด False Accept กรณี ผู้ทุจริตใช้งาน แล้วระบบไม่แจ้งเตือน มักทราบเหตุ
เมื่อเกิดความเสียหายขึ้นแล้ว จะมีช่องทางรับแจ้ง False Accept เพื่อปรับปรุงระบบฯ
ส่วนเคสที่เกิดขึ้น จะ Investigate หาความจริง หาผู้กระทาผิด หาสาเหตุ และช่องโหว่
ของเหตุการณ์ที่เกิดขึ้น
6.Demo Build a Fraud Detection Model
With Python in Google Colab
Facebook Page: Hard Skills Learn

More Related Content

More from manupat sriboonlue

Pdpa privacy protection act 2020 (pol.lt.manupat sriboonlue)
Pdpa privacy protection act 2020 (pol.lt.manupat sriboonlue)Pdpa privacy protection act 2020 (pol.lt.manupat sriboonlue)
Pdpa privacy protection act 2020 (pol.lt.manupat sriboonlue)manupat sriboonlue
 
Digital forensic for insurance 2019
Digital forensic for insurance 2019Digital forensic for insurance 2019
Digital forensic for insurance 2019manupat sriboonlue
 
Financial Technology (Fintech) 2018
Financial Technology (Fintech) 2018Financial Technology (Fintech) 2018
Financial Technology (Fintech) 2018manupat sriboonlue
 
Ecommerce credit score model 2018
Ecommerce credit score model 2018Ecommerce credit score model 2018
Ecommerce credit score model 2018manupat sriboonlue
 
Digital government opportunity and risk 2018
Digital government opportunity and risk 2018Digital government opportunity and risk 2018
Digital government opportunity and risk 2018manupat sriboonlue
 
Economic crime in technology1234
Economic crime in technology1234Economic crime in technology1234
Economic crime in technology1234manupat sriboonlue
 

More from manupat sriboonlue (6)

Pdpa privacy protection act 2020 (pol.lt.manupat sriboonlue)
Pdpa privacy protection act 2020 (pol.lt.manupat sriboonlue)Pdpa privacy protection act 2020 (pol.lt.manupat sriboonlue)
Pdpa privacy protection act 2020 (pol.lt.manupat sriboonlue)
 
Digital forensic for insurance 2019
Digital forensic for insurance 2019Digital forensic for insurance 2019
Digital forensic for insurance 2019
 
Financial Technology (Fintech) 2018
Financial Technology (Fintech) 2018Financial Technology (Fintech) 2018
Financial Technology (Fintech) 2018
 
Ecommerce credit score model 2018
Ecommerce credit score model 2018Ecommerce credit score model 2018
Ecommerce credit score model 2018
 
Digital government opportunity and risk 2018
Digital government opportunity and risk 2018Digital government opportunity and risk 2018
Digital government opportunity and risk 2018
 
Economic crime in technology1234
Economic crime in technology1234Economic crime in technology1234
Economic crime in technology1234
 

Data analytics for fraud detection 2021 manupat sriboonlue

  • 1.
  • 3. Topic 1.โจทย์ทาง Business เกี่ยวกับ Fraud Detection 3.Fraud Detection Rule-Based or Model-Based? 2.การทา Fraud Detection มีกี่วิธี? 4.ขั้นตอน Data Analytics for Fraud Detection (Model-Based) 5. Fraud Detection Model Important 6.Demo Build a Fraud Detection Model With Python in Google Colab
  • 8.
  • 10. 1.โจทย์ทาง Business เกี่ยวกับ Fraud Detection ใช้ RFM Model คานวณ Error ของ Fraud Detection ที่ยอมรับได้ และจานวนเงินที่ยอมสูญเสียได้ โดยใช้ข้อมูลในอดีต ก่อนจะวางกลยุทธ์ Fraud Detection ในปัจจุบัน R = Recency = ครั้งล่าสุดเมื่อไหร่ F = Frequency = ความถี่เท่าไหร่ M = Monetary = จานวนเงินเท่าไหร่
  • 11. 1.โจทย์ทาง Business เกี่ยวกับ Fraud Detection เช่น ปี 63 มีจานวนธุรกรรมในองค์กรทั้งหมด 1,000,000 ครั้ง เป็น Fraud จานวน 1,000 เคส สูญเสียเงินรวมจานวน 10 ล้านบาท (เฉลี่ย 1 หมื่นบาท/เคส) เป็น False Positive หรือ False Reject (ผู้ใช้งานตัวจริง ใช้งานไม่ได้ เพราะถูก Detect ว่าเป็น Fraud) จานวน 5,000 ครั้ง มี User ยกเลิกบริการ จานวน 1,000 ราย องค์กรสูญเสียรายรับที่ควรได้ จานวน 1 ล้านบาท เป็น False Negative หรือ False Accept (ผู้ร้ายเข้าใช้งาน ระบบกลับปล่อยผ่าน ไม่ Detect ว่าเป็น Fraud) จานวน 1,000 ครั้ง องค์กรสูญเสียรายได้ จานวน 10 ล้านบาท ดังนั้น ควรให้น้าหนักระบบ Fraud Detection ปัจจุบัน ไปทางลด False Accept มากกว่า ลด False Reject เป็นต้น
  • 12. 2.การทา Fraud Detection มีกี่วิธี?
  • 13. Fraud เกิดจากผู้โจมตีที่เป็นมนุษย์ การทา Fraud Detection ต้องปรับรูปแบบการ Detect อยู่ตลอด ดังนั้น ไม่ว่าจะ Detect ด้วยวิธีใด 2) Model-Based Detection (เรียนรู้จาก Dataset ในอดีต) 1) Rule-Based Detection (กาหนดเกณฑ์ Fraud ลักษณะ If Then Else) 3) Outlier Detection (พฤติกรรมการใช้งานที่ผิดปกติ) หาก Detect Fraud ได้ผล ก็นามาปรับใช้ได้ทั้งสิ้น
  • 14. Rule-Based Example Sample New Registration Rule: If IP_Address_Location == [‘Japan’] and Cust_Address_Country = [‘USA’] and CUSTOMER_PHONE_LOC == [‘Spain’] THEN Investigate
  • 16. Rule-Based = Predict Base on Rule Model-Based = Predict Base on Probability
  • 17. เปลี่ยนจาก การนาความรู้ของ Domain Expert (ผู้เชี่ยวชาญ) ที่ให้โปรแกรมเมอร์ เขียนคาสั่ง Program ลักษณะ If Then Else มาเป็น การสร้างโมเดล จากชุดข้อมูล ที่มี Attribute (คุณลักษณะ) กับ Label (ผลลัพท์) เพื่อให้ Program แสดง Output จากโมเดล ที่ได้เรียนรู้ จากชุดข้อมูลนั้น (กรณี Model Base Detection)
  • 19. Size (ตารางฟุต) Bedrooms Bathrooms Price 500 2 2 400K 1,000 3 2 600K 1,500 4 1 700K 2,000 4 2 750K 2,000 4 1 740K 3,000 5 2 800K Example: Predicting Real Estate Price Price = 0.3(Size) + 0.2(Bedroom) + 0.001(Bathrooms)
  • 20. ตัวอย่าง Dataset ของ Credit Card Fraud Detection
  • 22. 4.ขั้นตอน Data Analytics for Fraud Detection (Model-Based) 1)กาหนดโจทย์ปัญหาทาง Business (ตั้งคาถามที่ถูกต้อง) 2)เก็บรวบรวมข้อมูล (Data Warehouse , Data Lake , Data Engineer) 5)Evaluate วัดผล Model พร้อมปรับจูนแก้ไข Model 3)ทาความสะอาดข้อมูล (Data Cleansing) และสร้างกราฟ (Visualization) 4)นาชุดข้อมูล ทดสอบกับ Algorithm เพื่อสร้าง Model 6)นา Model Deploy ใช้งานจริง
  • 23. 1)กาหนดโจทย์ปัญหาทาง Business ตั้งคาถามที่ถูกต้อง - Fraud Detection - Sentiment Analysis - Facial Recognition - Churn Prediction - Customize Segmentation - Product Recommendation (โจทย์ Regression , Classification หรือ Clustering)
  • 25. Branch ATM Internet Banking Mobile Banking Data Warehouse Data Lake Data Analyst Data Scientist Dashboard Build Model Action Data Source ส่วนเก็บข้อมูล ส่วนวิเคราะห์ข้อมูล
  • 26.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37. 3)ทาความสะอาดข้อมูล (Data Cleansing) รวมถึง การทาข้อมูลให้เป็นรูปภาพ (Visualization) - ทาความสะอาด เชิงโครงสร้างข้อมูลทั่วไป - ทาความสะอาด เชิงก่อนนาเข้า Build Model เช่น ค่า Missing , N/A , Outlier , พิมพ์ผิด เป็นต้น กรณี Dataset ลักษณะ Imbalance ไม่สมดุล คือ ข้อมูลที่ต้องการทานาย มีจานวนน้อย เทียบกับข้อมูลทั้งหมด เช่น การทา Fraud Detection , Churn Prediction จะมีเทคนิค Undersampling , Oversampling เพื่อแก้ปัญหา
  • 38. ตัวอย่าง Data Dirty Photo Source: https://riccosmartdata.com/data-cleansing-or-data-cleaning
  • 45. Machine Learning Model • Custom Algorithm • Automl • Pre-trained Model
  • 46. Machine Learning • Supervised Learning (Predictive) • Unsupervised Learning (Descriptive) • Reinforcement Learning (Learn by Reward and Penalty)
  • 47.
  • 48.
  • 49.
  • 50.
  • 51.
  • 52. Photo Source : www.researchgate.net Outlier Detection
  • 53. 5)Evaluate วัดผล Model พร้อมปรับจูนแก้ไข Model (โจทย์ Regression , Classification หรือ Clustering)
  • 54. Mean Absolute Percentage Error (MAPE) Mean Absolute Error (MAE) การวัดผลโจทย์ Regression โจทย์ที่มีค่า Label (ค่า Y) เป็นลักษณะ Continuous (ตัวเลข)
  • 55.
  • 57.
  • 58. โจทย์ที่มีค่า Label (ค่า Y) ลักษณะจาแนกว่าเป็น Class ไหน การวัดผลโจทย์ Classification
  • 59.
  • 60. ROC & AUC ที่มา: https://qastack.in.th/stats/225210/accuracy-vs-area-under-the-roc-curve
  • 61. Source: www.oreilly.com การวัดผลโจทย์ Clustering วัดว่าควรจะแบ่งเป็นกี่กลุ่ม (ใช้ K กี่ตัว)
  • 62.
  • 63. 6)นา Model Deploy ใช้งานจริง - Embed - Push - Dashboard
  • 64. 6)นา Model Deploy ใช้งานจริง นา Model ที่ Build ได้ ออกมาเป็นไฟล์ การ Deploy ใช้ลักษณะ เรียก API (Application Programming Interface) ของโปรแกรมที่ใช้งาน มายัง Model
  • 65. 1) Imbalance Dataset 2) Confusion Matrix Evaluate Model 3) ROC & AUC Curve 4) Weight Model to False Reject & False Accept 5) Improve Process of Authentication & Investigation 5.Fraud Detection Model Important
  • 66. “Bad actors change tactics often”
  • 67. 2) ลด False Reject กรณี ผู้ใช้งานตัวจริง เข้าใช้งานไม่ได้ มักแจ้งมาทาง Call Center โดยเร็ว ดังนั้น รีบรับเคส False Reject จาก Call Center (หรือช่องทางอื่น) เพื่อปรับปรุงระบบ Fraud Detection ควรจา 3 ข้อ สาหรับ Fraud Detection 1) Fraud เกิดจากมนุษย์ รูปแบบการโจมตี เปลี่ยนได้ตลอด ดังนั้น ระบบตรวจจับ ต้องยืดหยุ่น เพื่อให้ตรวจจับได้อย่างทันท่วงที ไม่ว่าจะเป็นการปรับ Rule Base ของระบบตรวจจับ หรือ การใช้ Data ของ Fraud ในอดีต เพื่อสร้าง Model ตรวจจับ ก็ตาม (ต้องปรับได้ทั้ง Rule Base Model Base และ Outlier Base) 3) ลด False Accept กรณี ผู้ทุจริตใช้งาน แล้วระบบไม่แจ้งเตือน มักทราบเหตุ เมื่อเกิดความเสียหายขึ้นแล้ว จะมีช่องทางรับแจ้ง False Accept เพื่อปรับปรุงระบบฯ ส่วนเคสที่เกิดขึ้น จะ Investigate หาความจริง หาผู้กระทาผิด หาสาเหตุ และช่องโหว่ ของเหตุการณ์ที่เกิดขึ้น
  • 68. 6.Demo Build a Fraud Detection Model With Python in Google Colab
  • 69.
  • 70. Facebook Page: Hard Skills Learn