SlideShare une entreprise Scribd logo
1  sur  294
Practical Data Mining 

with RapidMiner Studio 7
: A Basic & Intermediate
Eakasit Pacharawongsakda, Ph.D.
13-15 March 2017

at K.U. Home Hotel, Kasetsart University
The 17th
course of
About us
Chapter 0
http://dataminingtrend.com http://facebook.com/datacube.th
About us
• ชื่อ: เอกสิทธิ์ พัชรวงศ์ศักดา
• การศึกษา:
• ปริญญาเอก วิทยาการคอมพิวเตอร์ 

สถาบันเทคโนโลยีนานาชาติสิรินธร (SIIT) มหาวิทยาลัยธรรมศาสตร์
• ปริญญาโท วิศวกรรมคอมพิวเตอร์ มหาวิทยาลัยเกษตรศาสตร์
• ปริญญาตรี วิศวกรรมคอมพิวเตอร์ มหาวิทยาลัยเกษตรศาสตร์ 

(เกียรตินิยมอันดับ 2)
• ประสบการณ์
• Certified RapidMiner Analyst and Ambassador
• Research Collaboration with Western Digital (Thailand) เฟสที่ 1 ระยะเวลา 6 เดือน
• ร่วมวิจัย โครงการสํารวจข้อมูลเพื่อการวิเคราะห์พฤติกรรมของนักท่องเที่ยวเชิงลึก ด้วยวิธีการทําเหมือง
ข้อมูล การท่องเที่ยวแห่งประเทศไทย (ททท)
• วิทยากรอบรมการใช้งานซอฟต์แวร์ open source ทางด้าน data mining
3
http://dataminingtrend.com http://facebook.com/datacube.th
About us
• หนังสือ Data Mining ฉบับภาษาไทย
4
http://dataminingtrend.com http://facebook.com/datacube.th
About us
5
RapidMiner Analyst
Certification
This is to Certify that
Successfully passed the examination for the Certified RapidMiner Analyst.
The RapidMiner Analyst certification level is designed for individuals who wish to demonstrate
a fundamental understanding of how RapidMiner software works and is used.
Certified Analyst professionals will be able to prepare data and create predictive models in
standard data environments typically found within most analyst positions.
The candidate has proven the ability to:
 Prepare data  Build predictive models
 Evaluate the model’s quality  Score new data sets
 Deploy data mining models
With:
 RapidMiner Studio  RapidMiner Server
Date:
Eakasit Pacharawongsakda
http://dataminingtrend.com http://facebook.com/datacube.th
in-house training (2016)
6
http://dataminingtrend.com http://facebook.com/datacube.th
in-house training
http://dataminingtrend.com http://facebook.com/datacube.th
8
Introduction to Data Mining
Chapter 1
http://dataminingtrend.com http://facebook.com/datacube.th
Where does data come from?
• ข้อมูลแบ่งตามที่มา
• ภายในบริษัท/องค์กร
• ข้อมูลการซื้อขาย
• ข้อมูลประวัติลูกค้า
• ข้อมูลประวัติพนักงาน
• ภายนอกบริษัท/องค์กร
• ข้อมูลจาก social media ต่างๆ
• ข้อมูลข่าวต่างๆ
• ข้อมูลรูปภาพและเสียง
10
source: http://dailyprivacy.files.wordpress.com/2013/02/2012_big_data_study_infographic_600.jpg
http://dataminingtrend.com http://facebook.com/datacube.th
Database & warehouse & mining
11
Database
Sales
Accounting
CRM
Extract

Transform

Load

(ETL)
Data Mining
Data Warehouse
image source:https://sites.google.com/a/whps.org/diamond-teamkp/

http://www.iconarchive.com/tag/data
http://dataminingtrend.com http://facebook.com/datacube.th
facebook.com/datacube.th
BI & Data Mining
12
Business
Intelligence
Data
Mining
Time
Analytical 

Approach
Past Future
Explanatory
Exploratory
source:Data Science and Big Data Analytics: Discovering, analyzing, visualizing and presenting data
BI questions
• What happened last
quarter?
• How many unit sold?
• Where is the problem? In
which situations
Data Mining questions
• What if … ?
• What will happen next?
• Why is this happen?
http://dataminingtrend.com http://facebook.com/datacube.th
What is data mining
13
ข้อมูล' เทคนิคการทำ data mining' รูปแบบที่มีประโยชน์'
image source:http://www.computerrepairanaheim.net

https://sites.google.com/a/whps.org/diamond-teamkp/

http://meetings2.informs.org/wordpress/analytics2014/2014/04/01/why-oranalytics-people-need-to-know-about-database-technology/
facebook.com/datacube.th
http://dataminingtrend.com http://facebook.com/datacube.th
Data mining application
• บัตรสมาชิก (loyalty card)
• ติดตามพฤติกรรมการซื้อสินค้า
ของลูกค้าจากบัตร loyalty
• นำมาวิเคราะห์และนำเสนอเป็น
โปรโมชันพิเศษให้แต่ละบุคคล
• เพิ่มโอกาสในการขายสินค้าให้กับ
ลูกค้า
• กระตุ้นให้ลูกค้าได้ซื้อสินค้ามาก
ขึ้น เช่น ซื้อสินค้าวันนี้ จะได้
ส่วนลดพิเศษ ทำให้ลูกค้าเกิดการ
ตัดสินใจซื้อทันที
14
image source: http://www.positioningmag.com
http://dataminingtrend.com http://facebook.com/datacube.th
Data mining application
• ทราบพฤติกรรมการซื้อสินค้าของลูกค้า เพื่อนำมาวิเคราะห์ และ

นำเสนอเป็นโปรโมชันพิเศษให้แต่ละบุคคล
15
image source: http://www.dream-base.com/tesco/clubcard.php?p=spend&lang=en
http://dataminingtrend.com http://facebook.com/datacube.th
Data mining application
• เบียร์และผ้าอ้อม
• ห้าง Walmart พบว่าทุกวันศุกร์
หลังบ่ายโมง จะมีลูกค้าเพศชาย
อายุระหว่าง 25 – 35 ปี ซื้อสินค้า
Beers และ Diapers มากที่สุด
16
image source:http://blog.beau-coup.com/guy-friendly-baby-showers-beer-and-diapers-theme
https://www.linkedin.com/pulse/20140403185417-4785379-diapers-and-beer
http://dataminingtrend.com http://facebook.com/datacube.th
Data mining application
• คาดการณ์การตั้งครรภ์
• ห้าง Target ทำการวิเคราะห์
พฤติกรรมการซื้อสินค้าของ
ลูกค้าเพศหญิง
• พบรูปแบบ (pattern) ว่า ถ้ามี
การซื้อวิตามิน ซื้ออาหารบำรุง
หรือ ซื้อตู้เตียงเพิ่ม ลูกค้าจะ
เริ่มตั้งครรภ์
• Target จะส่ง promotion ให้
ลูกค้าเหล่านั้น
17
source: http://www.youtube.com/watch?v=f2Kji24833Y
http://dataminingtrend.com http://facebook.com/datacube.th
Data mining application
• แนะนำสินค้าที่เกี่ยวข้อง
• amazon.com แนะนำหนังสือที่เกี่ยวข้องกับ RapidMiner
• Netflix แนะนำภาพยนต์ที่คล้ายกับที่เคยดู เช่น Life of Pi
18
source: http://www.amazon.com และ http://www.netflix.com
http://dataminingtrend.com http://facebook.com/datacube.th
Data mining application
• ทำนายอายุและเพศจากรูปภาพ
19
source: http://www.how-old.net
http://dataminingtrend.com http://facebook.com/datacube.th
Data mining application
• Google News แนะนำข่าวที่เกี่ยวข้อง
20
source:https://news.google.com
http://dataminingtrend.com http://facebook.com/datacube.th
Data mining application
• วิเคราะห์ทัศนคติในแง่ต่างๆ จากสังคมออนไลน์
21source:http://sentiment140.com และ http://www.techguide.com.au
http://dataminingtrend.com http://facebook.com/datacube.th
Data mining application
• วิเคราะห์ทัศนคติในแง่ต่างๆ จากสังคมออนไลน์ (ภาษาไทย)
22
source:http://pop.ssense.in.th
Introduction to CRISP-DM
Chapter 2
http://dataminingtrend.com http://facebook.com/datacube.th
CRISP-DM
• CRoss-Industry Standard Process for Data Mining (CRISP-DM)
• พัฒนาขึ้นโดย 3 บริษัท
• บริษัท SPSS
• บริษัท DaimlerChrysler
• บริษัท NCR
• เป็น Workflow มาตรฐานสำหรับการทำ data mining
• ประกอบด้วย 6 ขั้นตอน
24
http://dataminingtrend.com http://facebook.com/datacube.th
CRISP-DM
25
3 ขั้นตอนแรกจะใช้เวลา
80% ของทั้งหมด
1 2
3
4
5
6
image source: Foster Provost, Data Science for Business: What you need to know about data mining and data-analytic thinking, August 19, 2013
facebook.com/datacube.th
http://dataminingtrend.com http://facebook.com/datacube.th
1. Business Understanding
• ขั้นตอนแรกของ CRISP-DM
• ทำความเข้าใจกับปัญหา หรือ โอกาสเชิงธุรกิจ
• ระบุ output หรือเป้าหมายที่ต้องการได้จากการวิเคราะห์ข้อมูลด้วย data mining
• ตัวอย่างเช่น
• ทำอย่างไรถึงเพิ่มยอดขายให้กับสินค้าชนิดต่างๆ ได้
• ต้องการแบ่งกลุ่มนักศึกษาออกตามความสนใจ
• ทำอย่างไรให้ลูกค้ากลับมาซื้อสินค้าได้อีก
• อยากทำนายปริมาณน้ำฝนที่ตกใน 2 วันถัดไป
• อยากรู้ว่าลูกค้าคนใดบ้างมีโอกาสป่วยเป็นโรคมะเร็ง
26
Business
Understanding	
Data
Understanding	
Data
Preparation	
Modeling Evaluation Deployment
http://dataminingtrend.com http://facebook.com/datacube.th
• ในขั้นตอนนี้เป็นการ
• รวบรวมข้อมูลที่เกี่ยวข้อง
• ข้อมูลถูกต้องน่าเชื่อถือ
• ข้อมูลที่ได้มีปริมาณมากพอหรือยัง
• ข้อมูลที่ได้มีความเหมาะสม มีรายละเอียดเพียงพอต่อการนำไปใช้ในการวิเคราะห์
• ตัวอย่าง
• ข้อมูลการซื้อสินค้าคนแต่ละบุคคล
• ข้อมูลการลงทะเบียนและผลการศึกษาของนักศึกษา
Business
Understanding	
Data
Understanding	
Data
Preparation	
Modeling Evaluation Deployment
2. Data Understanding
27
http://dataminingtrend.com http://facebook.com/datacube.th
• ขั้นตอนการเตรียมข้อมูลเป็นขั้นตอนที่ใช้เวลานานที่สุด
• เนื่องจากโมเดลที่ได้จากการทำดาต้าไมน์นิ่งจะให้ผลลัพทธ์ที่ถูกต้อง
หรือไม่นั้น ขึ้นอยู่กับคุณภาพของข้อมูลที่ใช้ แบ่งออกได้เป็น 3 ขั้นตอน
ย่อยคือ
• 3.1 ทำการคัดเลือกข้อมูล (Data Selection) 
• กำหนดเป้าหมายก่อนว่าเราจะทำการวิเคราะห์อะไร
• เลือกใช้เฉพาะข้อมูลที่เกี่ยวข้องกับสิ่งที่เราจะทำการวิเคราะห์
Business
Understanding	
Data
Understanding	
Data
Preparation	
Modeling Evaluation Deployment
3. Data Preparation
28
http://dataminingtrend.com http://facebook.com/datacube.th
• 3.2 ทำการกลั่นกรองข้อมูล (Data Cleaning) 
• ลบข้อมูลซ้ำซ้อน
• แก้ไขข้อมูลที่ผิดพลาด
• ข้อมูลผิดรูปแบบ
• ข้อมูลที่หายไป
• ข้อมูล outlier ที่แปลกแยกจากคนอื่น
Business
Understanding	
Data
Understanding	
Data
Preparation	
Modeling Evaluation Deployment
3. Data Preparation
29
รหัส เพศ อายุ ความสูง น้ำหนัก
57001 ชาย 18 180 70
5702A ญ 80 35
57123 หญิง 19 150 2500
58002 ช 17 175 90
ข้อมูลนักศึกษาชั้นปีที่ 1 ปีการศึกษา 2557
ผิดรูปแบบ ขาดหาย outlier
http://dataminingtrend.com http://facebook.com/datacube.th
• 3.3 แปลงรูปแบบของข้อมูล (data transformation)
• เป็นขั้นตอนการเตรียมข้อมูลให้อยู่ในรูปแบบที่พร้อมนำไปใช้ในการวิเคราะห์

ตามอัลกอริทึมของ data mining ที่เลือกใช้
Business
Understanding	
Data
Understanding	
Data
Preparation	
Modeling Evaluation Deployment
3. Data Preparation
30
ID สินค้า จำนวนที่ซื้อ
1 ปากกา 1
1 ยางลบ 1
1 คลิป 10
2 สมุด 2
2 ปากกา 2
3 สมุด 1
3 ปากกา 3
3 ยางลบ 2
ID สมุด ปากกา ยางลบ คลิป
1 - TRUE TRUE TRUE
2 TRUE TRUE - -
3 TRUE TRUE TRUE -
ข้อมูลในฐานข้อมูล POS
ข้อมูลสำหรับการหากฏความสัมพันธ์ (Association Rules)
http://dataminingtrend.com http://facebook.com/datacube.th
• 3.3 แปลงรูปแบบของข้อมูล (data transformation)
• เป็นขั้นตอนการเตรียมข้อมูลให้อยู่ในรูปแบบที่พร้อมนำไปใช้ในการวิเคราะห์

ตามอัลกอริทึมของ data mining ที่เลือกใช้
Business
Understanding	
Data
Understanding	
Data
Preparation	
Modeling Evaluation Deployment
3. Data Preparation
31
เมื่อวันที่ 4 มกราคม 2557 เฟซบุ๊กเปิดตัวหน้าเพจใหม่ชื่อว่า Facebook A Look Back เมื่อผู้ใช้งาน
คลิกไปยังหน้านี้ก็จะแสดงคลิปวิดีโอที่บอกเล่าเรื่องราวของผู้ใช้งานคนนั้นๆ เช่น เริ่มเล่นเฟซบุ๊กครั้ง
แรกปีไหน, โพสต์แรกบนเฟซบุ๊ก, รูปภาพที่ถูกกดไลค์มากที่สุด, รูปภาพที่ถูกแชร์มากที่สุด และ 20
อันดับเรื่องราวต่าง ๆ ที่เกิดขึ้นในเฟซบุ๊กก็จะถูกแสดงและรวบรวมไว้ในคลิปวิดีโอนี้
ID เฟซบุ๊ก รูปภาพ ไลค์ แชร์ คลิปวิดีโอ
1 4 2 1 1 2
2 …
เอกสารข่าว
ตารางแสดงจำนวนความถี่ของแต่ละคำ
http://dataminingtrend.com http://facebook.com/datacube.th
• 3.3 แปลงรูปแบบของข้อมูล (data transformation)
• เป็นขั้นตอนการเตรียมข้อมูลให้อยู่ในรูปแบบที่พร้อมนำไปใช้ในการวิเคราะห์

ตามอัลกอริทึมของ data mining ที่เลือกใช้
Business
Understanding	
Data
Understanding	
Data
Preparation	
Modeling Evaluation Deployment
3. Data Preparation
32
ID สีแดง สีเขียว สีน้ำเงิน
1 93 98 167
2 …
รูปภาพ
จำนวน pixel สีแดง สีเขียว สีนำ้เงินที่ปรากฏในรูปภาพ
image source:http://www.travelhouse.ch/reisen/thailand/phuket/jw-marriott-phuket-resort-and-spa
http://dataminingtrend.com http://facebook.com/datacube.th
CRISP-DM
33
3 ขั้นตอนหลังจะใช้เวลา
20% ของทั้งหมด
1 2
3
4
5
6
image source: Foster Provost, Data Science for Business: What you need to know about data mining and data-analytic thinking, August 19, 2013
http://dataminingtrend.com http://facebook.com/datacube.th
• เป็นขั้นตอนการวิเคราะห์ข้อมูลด้วยเทคนิคดาต้าไมน์นิ่ง
• classification
• สร้างโมเดลจากข้อมูลที่มีอยู่เพื่อทำนายอนาคต
• เช่น ทำนายปริมาณน้ำฝนที่ตกในวันถัดไป
• clustering
• แบ่งข้อมูลหลายๆ กลุ่มตามความคล้ายคลึง
• เช่น แบ่งกลุ่มนักศึกษาตามคะแนนที่ได้
• association rules
• หาความสัมพันธ์ของข้อมูลที่เกิดร่วมกัน
• เช่น ค้นหาสินค้าที่มีการซื้อร่วมกันบ่อยๆ
Business
Understanding	
Data
Understanding	
Data
Preparation	
Modeling Evaluation Deployment
4. Modeling
34
classification
clustering
association rules
http://dataminingtrend.com http://facebook.com/datacube.th
• ประเมินหรือวัดประสิทธิภาพของโมเดลวิเคราะห์ข้อมูลในขั้นตอนก่อน
หน้านั้น
Business
Understanding	
Data
Understanding	
Data
Preparation	
Modeling Evaluation Deployment
5. Evaluation
35
VS
โมเดล decision tree โมเดล neural network
http://dataminingtrend.com http://facebook.com/datacube.th
Business
Understanding	
Data
Understanding	
Data
Preparation	
Modeling Evaluation Deployment
6. Deployment
• นำโมเดลที่ได้ หรือ ผลการวิเคราะห์ที่ได้ไปใช้งานจริง
36
ใช้จากกฏความสัมพันธ์ที่หาได้
image source: http://www.mysupermarket.co.uk/brands/tesco_discounter_brand_in_tesco.html
http://dataminingtrend.com http://facebook.com/datacube.th
CRISP-DM Example 1
• ตัวอย่าง CRISP-DM
• อ้างอิงจากงานวิจัยเรื่อง การใช้เทคนิคดาต้าไมน์นิงเพื่อพัฒนาคุณภาพการ
ศึกษานิสิตคณะวิศวกรรมศาสตร์ *
1. Business Understanding
• นิสิตคณะวิศวกรรมศาสตร์ ม.เกษตรศาสตร์ จะเลือกภาควิชาเมื่อในชั้นปีที่ 2
• นิสิตเลือกภาควิชาไม่ตรงกับความสามารถของตนเอง
• เลือกตามเพื่อน
• เลือกตามที่ผู้ปกครองแนะนำ
• นิสิตบางคนได้ผลการเรียนตกต่ำและทำให้ต้องออกจากมหาวิทยาลัยกลางคัน
37
* กฤษณะ ไวยมัย , ชิดชนก ส่งศิริ และ ธนาวินท์ รักธรรมานนท์, การใช้เทคนิคดาต้าไมน์นิงเพื่อพัฒนาคุณภาพการศึกษานิสิตคณะ

วิศวกรรมศาสตร์, NECTEC Technical Journal, 3(11), 2001
http://dataminingtrend.com http://facebook.com/datacube.th
CRISP-DM Example 1
2. Data Understanding
• ข้อมูลนิสิตคณะวิศวกรรมศาสตร์ ม.เกษตรศาสตร์ช่วงปี พ.ศ. 2535 - 2542
• นิสิตประมาณ 10,000 คน
• ข้อมูลมีจำนวน 476,085 แถว
• ข้อมูลแบ่งเป็น 2 ส่วน
• ข้อมูลประวัติส่วนตัวของนิสิต
• เพศ, ที่อยู่, GPA ระดับมัธยมปลาย, GPA ชั้นปีที่ 1
• ข้อมูลการลงทะเบียนของนิสิต
• เกรดวิชาคณิตศาสตร์, เกรดวิชาฟิสิกส์, เกรดวิชาเคมี
38
http://dataminingtrend.com http://facebook.com/datacube.th
CRISP-DM Example 1
3. Data Preparation
• คัดเลือกวิชาที่เกี่ยวข้องกับภาควิชาต่างๆ ในคณะวิศวกรรมศาสตร์
• แปลงข้อมูลให้เหมาะสมกับการวิเคราะห์
39
รหัสนิสิต เพศ ที่อยู่ GPA มัธยมปลาย … GPA
37058063 ชาย กรุงเทพ 2.5 … 2.3
37058167 ชาย สงขลา 3.4 … 3.3
… … … … … …
ข้อมูลประวัติส่วนตัวของนิสิต
รหัสนิสิต วิชา ปีการศึกษา เกรด
37058063 คอมพิวเตอร์ 2537 C+
37058063 คณิตศาสตร์ 2537 D
… … … …
ข้อมูลการลงทะเบียนของนิสิต
รหัสนิสิต เพศ คอมพิวเตอร์ คณิตศาสตร์ … GPA
37058063 ชาย LOW LOW … 2.3
37058167 ชาย HIGH HIGH … 3.3
… … … … … …
ข้อมูลสำหรับการใช้วิเคราะห์
http://dataminingtrend.com http://facebook.com/datacube.th
CRISP-DM Example 1
4. Modeling
• แบ่งข้อมูลออกเป็น 2 ส่วน คือ
• 70% ของข้อมูลทั้งหมดใช้ในการสร้างโมเดล
• 30% ของข้อมูลทั้งหมดใช้ในการทดสอบประสิทธิภาพของโมเดล
• สร้างโมเดลด้วยเทคนิค Decision Tree ซึ่งจะได้โมเดลที่สามารถเข้าใจได้ง่าย
• โมเดลแบ่งแยกตามภาควิชาต่างๆ เช่น ภาควิชาวิศวกรรมคอมพิวเตอร์ วิศกรรมไฟฟ้า
• คำตอบ (class) จะแบ่งเป็น 2 ประเภท คือ
• GOOD หมายถึง นิสิตเรียนในภาควิชานี้แล้วจบมาได้ GPA อยู่ในช่วง 40% แรก (top 40%)
• BAD หมายถึง นิสิตเรียนในภาควิชานี้แล้วจบมาได้ GPA อยู่ในช่วง 40% จากท้าย (bottom
40%)
40
http://dataminingtrend.com http://facebook.com/datacube.th
CRISP-DM Example 1
4. Modeling
41
Computer
= HIGH = LOW
Physics
Good
Good
= LOW = HIGH
Mathematics
Good Bad
= HIGH = LOW
• IF Computer is HIGH THEN
Graduate is Good
• IF Computer is LOW AND

Mathematics is HIGH THEN

Graduate is Good
• IF Computer is LOW AND

Mathematics is LOW AND

Physics is HIGH THEN

Graduate is Good
• IF Computer is LOW AND

Mathematics is LOW AND

Physics is LOW THEN

Graduate is Bad
โมเดลของภาควิชาวิศวกรรมคอมพิวเตอร์
เงื่อนไขที่สร้างได้จากโมเดล
http://dataminingtrend.com http://facebook.com/datacube.th
CRISP-DM Example 1
5. Evaluation
• ทดสอบด้วยข้อมูล 30% ที่แบ่งไว้
• คำนวณค่าความถูกต้อง
6. Deployment
• นำไปแนะนำนิสิตชั้นปีที่ 1 ที่กำลัง

จะเลือกภาควิชา
• พิจารณาจากเกรดตามโมเดล

ที่สร้างได้
42
Computer
= HIGH = LOW
Physics
Good
Good
= LOW = HIGH
Mathematics
Good Bad
= HIGH = LOW
โมเดลของภาควิชาวิศวกรรมคอมพิวเตอร์
รหัสนิสิต เพศ คอมพิวเตอร์ คณิตศาสตร์ … Com Eng
5700123 ชาย LOW HIGH … ??
ข้อมูลของนักศึกษาปีที่ 1 ที่ต้องการได้รับคำแนะนำ
http://dataminingtrend.com http://facebook.com/datacube.th
CRISP-DM Example 1
5. Evaluation
• ทดสอบด้วยข้อมูล 30% ที่แบ่งไว้
• คำนวณค่าความถูกต้อง
6. Deployment
• นำไปแนะนำนิสิตชั้นปีที่ 1 ที่กำลัง

จะเลือกภาควิชา
• พิจารณาจากเกรดตามโมเดล

ที่สร้างได้
43
Computer
= HIGH = LOW
Physics
Good
Good
= LOW = HIGH
Mathematics
Good Bad
= HIGH = LOW
โมเดลของภาควิชาวิศวกรรมคอมพิวเตอร์
รหัสนิสิต เพศ คอมพิวเตอร์ คณิตศาสตร์ … Com Eng
5700123 ชาย LOW HIGH … ??
ข้อมูลของนักศึกษาปีที่ 1 ที่ต้องการได้รับคำแนะนำ
http://dataminingtrend.com http://facebook.com/datacube.th
CRISP-DM Example 1
5. Evaluation
• ทดสอบด้วยข้อมูล 30% ที่แบ่งไว้
• คำนวณค่าความถูกต้อง
6. Deployment
• นำไปแนะนำนิสิตชั้นปีที่ 1 ที่กำลัง

จะเลือกภาควิชา
• พิจารณาจากเกรดตามโมเดล

ที่สร้างได้
44
Computer
= HIGH = LOW
Physics
Good
Good
= LOW = HIGH
Mathematics
Good Bad
= HIGH = LOW
โมเดลของภาควิชาวิศวกรรมคอมพิวเตอร์
รหัสนิสิต เพศ คอมพิวเตอร์ คณิตศาสตร์ … Com Eng
5700123 ชาย LOW HIGH … ??
ข้อมูลของนักศึกษาปีที่ 1 ที่ต้องการได้รับคำแนะนำ
http://dataminingtrend.com http://facebook.com/datacube.th
CRISP-DM Example 1
5. Evaluation
• ทดสอบด้วยข้อมูล 30% ที่แบ่งไว้
• คำนวณค่าความถูกต้อง
6. Deployment
• นำไปแนะนำนิสิตชั้นปีที่ 1 ที่กำลัง

จะเลือกภาควิชา
• พิจารณาจากเกรดตามโมเดล

ที่สร้างได้
45
Computer
= HIGH = LOW
Physics
Good
Good
= LOW = HIGH
Mathematics
Good Bad
= HIGH = LOW
โมเดลของภาควิชาวิศวกรรมคอมพิวเตอร์
รหัสนิสิต เพศ คอมพิวเตอร์ คณิตศาสตร์ … Com Eng
5700123 ชาย LOW HIGH … Good
ข้อมูลของนักศึกษาปีที่ 1 ที่ต้องการได้รับคำแนะนำ
Introduction to 

RapidMiner Studio 7
Chapter 3
http://dataminingtrend.com http://facebook.com/datacube.th
Data mining software
• Commercial software
• SAS Enterprise Miner
• IBM SPSS Modeller
• RapidMiner Studio
47
• Open source software
• RapidMiner Studio
• Weka
• R
http://dataminingtrend.com http://facebook.com/datacube.th
Data mining software
• RapidMiner Studio 7
48
http://dataminingtrend.com http://facebook.com/datacube.th
Data mining software
• Weka
49
http://dataminingtrend.com http://facebook.com/datacube.th
Data mining software
• R
50
http://dataminingtrend.com http://facebook.com/datacube.th
Introduction RapidMiner
• RapidMiner
• ในตอนแรกใช้ชื่อบริษัทว่า Rapid-I ก่อตั้งขึ้นเมื่อปี 2006
• ในช่วงแรกบริษัทตั้งอยู่ที่ประเทศเยอรมนี
• ปี 2013 ได้เปลี่ยนชื่อบริษัทเป็น RapidMiner หลังจาก

ได้รับเงินลงทุนจำนวน 5 ล้านเหรียญสหรัฐ
• และย้ายบริษัทมาอยู่ที่บอสตัน ประเทศสหรัฐอเมริกา
• ผลิตภัณฑ์หลักของบริษัทคือ RapidMiner Studio 7
• บริษัทชั้นนำต่างๆ เช่น PayPal ใช้ซอฟต์แวร์ RapidMiner Studio 7
51
Ingo Mierswa
Ralf Klinkenberg
source: http://techcrunch.com/2013/11/04/german-predictive-analytics-startup-rapid-i-rebrands-as-rapidminer-takes-5m-from-open-ocean-

earlybird-to-tackle-the-u-s-market/
http://dataminingtrend.com http://facebook.com/datacube.th
Why RapidMiner?
• ผลการสำรวจจากเว็บไซต์ KDnuggets ในปี 2014 พบว่าผู้ร่วมตอบ
แบบสำรวจใช้ RapidMiner ในการวิเคราะห์ข้อมูลมากเป็นอันดับ 1
• Gartner ได้จัดให้ RapidMiner อยู่

ในกลุ่ม Leaders สำหรับซอฟต์แวร์

ในการวิเคราะห์ข้อมูล (2016)
• SAS
• IBM
• KNIME
• RapidMiner
52
source: http://www.kdnuggets.com/2014/06/kdnuggets-annual-software-poll-rapidminer-continues-lead.html

https://www.gartner.com/doc/reprints?id=1-2YEVU8U&ct=160210&st=sb
http://dataminingtrend.com http://facebook.com/datacube.th
RapidMiner Studio 7
• download ได้จาก http://rapidminer.com
53
คลิกที่เมนูนี้
http://dataminingtrend.com http://facebook.com/datacube.th
RapidMiner Studio 7
• เลือกดาวน์โหลด version ที่เหมาะสมกับระบบปฏิบัติการของเรา
54
http://dataminingtrend.com http://facebook.com/datacube.th
RapidMiner Professional License
55
http://dataminingtrend.com http://facebook.com/datacube.th
• พบกับหน้าต่าง Home Screen
RapidMiner Studio 7
56
1 แนะนำการใข้งานเบื้องต้น
4
3
เปิด process ที่มีอยู่
สร้าง process ใหม่
2 ดูตัวอย่างที่เตรียมไว้
http://dataminingtrend.com http://facebook.com/datacube.th
RapidMiner Studio 7
• องค์ประกอบของ RapidMiner Studio 7
57
Repository
Operators
Process
Parameter
help
1
2
3
4
5
http://dataminingtrend.com http://facebook.com/datacube.th
RapidMiner Studio 7
• เมนูใน RapidMiner Studio 7
58
ใช้สร้าง process ใหม่
โหลด process เดิม
บันทึก process
undo หรือ redo
สั่งให้ process ทำงาน (run)
ยกเลิก process (stop)
เมนูสำหรับปรับเปลี่ยนมุมมองของ
RapidMiner Studio 7
เมนูสำหรับแสดงวิธีการใช้งานในรูปแบบต่างๆ
ba
a
b
หน้า Design แสดงหน้าสำหรับการสร้างโพรเซส
หน้า Results แสดงหน้าผลลัพธ์การทำงาน
Pre-processing
Chapter 4
http://dataminingtrend.com http://facebook.com/datacube.th
Data
• ข้อมูลแสดงในรูปแบบของตาราง
• แถว เรียกว่า ตัวอย่าง (example)
• คอลัมน์ เรียกว่า แอตทริบิวต์ (attribute) ซึ่มีหน้าที่ (role) ที่ใช้งานบ่อย 3 แบบ
• ไอดี (ID) เป็นแอตทริบิวต์ที่แสดงหมายเลขของข้อมูล หรือ primary key ในฐานข้อมูล
• แอตทริบิวต์ทั่วไป (attribute) เป็นแอตทริบิวต์ปกติที่จะใช้ในการสร้างโมเดลหรือเรียกว่า
เป็น ฟีเจอร์ (feature) หรือตัวแปรต้น (independent variable)
• ลาเบล (label) เป็นแอตทริบิวต์ขนิดพิเศษที่มักจะใช้แสดงคำตอบของสิ่งที่เราต้องการจะ
สร้างโมเดลมาทำนาย หรือ เรียกว่า คลาส (class) หรือตัวแปรตาม (dependent
variable)
60
customer_id age gender region income married children car response
ID12101 48 FEMALE INNER_CITY 17546.0 NO 1 NO NO
ID12102 40 MALE TOWN 30085.1 YES 3 YES NO
ID12103 51 FEMALE INNER_CITY 16575.4 YES 0 YES YES
ID12104 23 FEMALE TOWN 20375.4 YES 3 NO NO
attribute labelID
http://dataminingtrend.com http://facebook.com/datacube.th
Value type
• ค่าของข้อมูลที่เก็บในแต่ละแอตทริบิวต์
• Polynominal ข้อมูลประเภท category (ข้อมูลที่ไม่ใช่ตัวเลข) มีค่ามากกว่า 2 ค่าขึ้น
ไป
• Binominal ข้อมูลประเภท category (ข้อมูลที่ไม่ใช่ตัวเลข) มีค่าเพียง 2 ค่าเท่านั้น
• Numeric หรือ Integer ข้อมูลประเภทตัวเลข
• Text ข้อมูลประเภทข้อความ
61
numericpolynominal
customer_id age gender region income married children car response
ID12101 48 FEMALE INNER_CITY 17546.0 NO 1 NO NO
ID12102 40 MALE TOWN 30085.1 YES 3 YES NO
ID12103 51 FEMALE INNER_CITY 16575.4 YES 0 YES YES
ID12104 23 FEMALE TOWN 20375.4 YES 3 NO NO
numeric numeric binominalbinominal binominal
http://dataminingtrend.com http://facebook.com/datacube.th
Data management
• Repository
• เป็นที่เก็บข้อมูลและ process เพื่อใช้งานใน RapidMiner 

Studio 7
• ทำให้ไม่ต้องโหลดข้อมูลจากไฟล์ใหม่ทุกครั้ง
• องค์ประกอบในส่วน Repository
• ส่วนที่
• สำหรับสร้าง Repository ใหม่
• โหลดไฟล์ประเภทต่างๆ เข้าไปไว้ใน Repository
• สร้างโฟลเดอร์ใหม่
• ส่วนที่
• ข้อมูลและ process Sample ที่ RapidMiner Studio 7 เตรียมไว้ให้
• ข้อมูลที่เก็บอยู่ในแต่ละ Repository
62
1
2
1
2
http://dataminingtrend.com http://facebook.com/datacube.th
Data management
• สร้าง Repository ใหม่
• คลิกที่
• หลังจากนั้นเลือกเมนู Create repository
63
2
1
2
http://dataminingtrend.com http://facebook.com/datacube.th
Data management
• สร้าง Repository ใหม่ (ต่อ)
• เลือก New local repository
• กดปุ่ม Next
64
3
4
http://dataminingtrend.com http://facebook.com/datacube.th
• สร้าง Repository ใหม่ (ต่อ)
• เปลี่ยนชื่อ Alias เป็น RapidMinerTraining
• กดปุ่ม Finish
Data management
65
6
5
http://dataminingtrend.com http://facebook.com/datacube.th
Data management
• จะปรากฏ repository RapidMinerTraining แสดงขึ้นมาในส่วนของ
Repository
66
repository ที่
สร้างขึ้นมาใหม่
http://dataminingtrend.com http://facebook.com/datacube.th
Data management
• สร้างโฟลเดอร์ใน RapidMinerTraining
• data สำหรับเก็บข้อมูล
67
7
8
9
10
http://dataminingtrend.com http://facebook.com/datacube.th
Data management
• สร้างโฟลเดอร์ใน RapidMinerTraining
• data สำหรับเก็บข้อมูล
• process สำหรับเก็บโพรเซสที่สร้างขึ้น
68
11
12
13
14
http://dataminingtrend.com http://facebook.com/datacube.th
• ไฟล์ประเภท csv ย่อมาจาก Comma Separated Value
• ใช้เครื่องหมาย , (comma) คั่นระหว่างแอตทริบิวต์
customer_id age gender region income married children car response
ID12101 48 FEMALE INNER_CITY 17546.0 NO 1 NO NO
ID12102 40 MALE TOWN 30085.1 YES 3 YES NO
ID12103 51 FEMALE INNER_CITY 16575.4 YES 0 YES YES
ID12104 23 FEMALE TOWN 20375.4 YES 3 NO NO
CSV File
69
customer_id,age,gender,region,income,married,children,ca,response
ID12101,48,FEMALE,INNER_CITY,17546.0,NO,1,NO,NO
ID12102,40,MALE,TOWN,30085.1,YES,3,YES,NO
ID12103,51,FEMALE,INNER_CITY,16575.4,YES,0,YES,YES
ID12104,23,FEMALE,TOWN,20375.4,YES,3,NO,NO
แถวแรกคือ header
http://dataminingtrend.com http://facebook.com/datacube.th
CSV File
• ไฟล์ csv สามารถ export ได้จาก Excel หรือ database ต่างๆ
• Export จาก Excel
• เลือก File > Save As > CSV (Comma delimited)
70
http://dataminingtrend.com http://facebook.com/datacube.th
Load CSV to RapidMiner
• การโหลดไฟล์ csv เข้าไปใช้ใน RapidMiner Studio 7 ทำได้ 2 แบบ
• ใช้การ import ในส่วนของ Repositories
• โหลดมาเก็บไว้ใน Repository และใช้งาน

ได้ตลอด
• ถ้าข้อมูลในไฟล์ csv มีการเปลี่ยนแปลงจะ

ไม่ update ต้องทำการโหลดใหม่
• ใช้โอเปอเรเตอร์ Read CSV
• โหลดเข้ามาใช้งานโดยการอ่านจากไฟล์ csv 

ทุกครั้ง เมื่อไฟล์ update ข้อมูลจะเปลี่ยนตาม
71
http://dataminingtrend.com http://facebook.com/datacube.th
Data preparation
• การจัดการข้อมูล (preprocessing)
• การเลือกแอตทริบิวต์
• เลือกตามประเภทของแอตทริบิวต์
• เลือกบางแอตทริบิวต์
• การเลือกข้อมูล (example) ตามเงื่อนไข
• การ join ข้อมูลจาก 2 ชุด
• มีความผิดพลาดในชุดข้อมูล เช่น
• ข้อมูลมีค่าไม่ตรงกัน
• ข้อมูลขาดขายไป
• ข้อมูลแปลกแยก (outlier)
72
• การแปลงข้อมูล
• Discretization แปลงข้อมูล
numeric ให้เป็น nominal
• แบ่งตามเงื่อนไขที่กำหนด
(user defined)
• แบ่งตามความถี่ที่เท่ากัน
(equal frequency)
http://dataminingtrend.com http://facebook.com/datacube.th
Outlier
73
หมายเลข อายุ รายได้ เพศ
1 15 15,000 ชาย
2 20 15,000 ชาย
3 20 20,000 ชาย
4 20 25,000 หญิง
5 25 25,000 หญิง
6 40 35,000 ชาย
7 45 40,000 หญิง
8 45 45,000 ชาย
9 50 35,000 ชาย
10 50 50,000 หญิง
ข้อมูลลูกค้า
10 15 20 25 30 35 40 45 50 55 60 65
10,000
15,000
20,000
25,000
30,000
35,000
40,000
45,000
50,000
55,000
60,000
65,000
รายได้
อายุ
scatter plot ของข้อมูลลูกค้า
เพศชาย เพศหญิง
http://dataminingtrend.com http://facebook.com/datacube.th
Outlier
74
หมายเลข อายุ รายได้ เพศ
1 15 15,000 ชาย
2 20 15,000 ชาย
3 20 20,000 ชาย
4 20 25,000 หญิง
5 25 25,000 หญิง
6 40 35,000 ชาย
7 45 40,000 หญิง
8 45 45,000 ชาย
9 50 35,000 ชาย
10 50 50,000 หญิง
11 10 65,000 ชาย
12 65 10,000 หญิง
ข้อมูลลูกค้า
scatter plot ของข้อมูลลูกค้า
10 15 20 25 30 35 40 45 50 55 60 65
10,000
15,000
20,000
25,000
30,000
35,000
40,000
45,000
50,000
55,000
60,000
65,000
รายได้
อายุ
เพศชาย เพศหญิง
outlier
outlier
http://dataminingtrend.com http://facebook.com/datacube.th
Detect outlier by distance
• วัดระยะห่างระหว่างข้อมูล (example) แต่ละตัวกับข้อมูลใกล้เคียง
• outlier คือ ข้อมูลที่มีระยะห่างกับข้อมูลอื่นๆ มากๆ
75
10 15 20 25 30 35 40 45 50 55 60 65
10,000
15,000
20,000
25,000
30,000
35,000
40,000
45,000
50,000
55,000
60,000
65,000
รายได้
อายุ
เพศชาย เพศหญิง
d1>d2
d2
d3>d4
d4
scatter plot ของข้อมูลลูกค้า
http://dataminingtrend.com http://facebook.com/datacube.th
Detect outlier by distance
• โอเปอเรเตอร์ที่เกี่ยวข้อง
76
โอเปอเรเตอร์ คำอธิบาย
Generate Data ใช้สำหรับสร้างข้อมูล
Detect Outlier
(Distances) ใช้ในการหา outlier ด้วยวิธีดูจากระยะห่างระหว่างข้อมูล
Filter Examples ลบข้อมูลตามเงื่อนไขที่กำหนด
http://dataminingtrend.com http://facebook.com/datacube.th
Detect outlier by distance
• เลือกตัวอย่าง Process ที่ RapidMiner Studio 7 เตรียมไว้ให้
• เลือก Samples > Processes > 02_Preprocessing > 17_OutlierDetection
77
1
double click เพื่อ
โหลด process
2
http://dataminingtrend.com http://facebook.com/datacube.th
Detect outlier by distance
• แสดงข้อมูลแบบ scatter plot
78
3
4
http://dataminingtrend.com http://facebook.com/datacube.th
Detect outlier by distance
• แสดงข้อมูล outlier ใน scatter plot
79
outlier
6
5
http://dataminingtrend.com http://facebook.com/datacube.th
Detect outlier by distance
• ลบข้อมูลที่เป็น outlier ทิ้ง
80
Association Rules
Chapter 5
http://dataminingtrend.com http://facebook.com/datacube.th
Market Basket Analysis
• เริ่มจากการสังเกตุการซื้อสินค้าของลูกค้าแต่ละราย
• วิเคราะห์ข้อมูลเพื่อดูว่า สินค้าอะไรบ้างที่ลูกค้ามักจะซื้อร่วมกันบ่อยๆ
• ใช้ในการออกโปรโมชันเพ่ือเพิ่มยอดขาย
82
image source:http://www.computerrepairanaheim.net
https://commons.wikimedia.org/wiki/File%3AShopping_cart_with_food_clip_art_2.svg
http://dataminingtrend.com http://facebook.com/datacube.th
Market Basket Analysis
• Amazon.com example
83
http://dataminingtrend.com http://facebook.com/datacube.th
Market Basket Analysis
• แปลงข้อมูลจาก POS database เป็น transaction database โดย
group by ตามเวลาที่ซื้อสินค้า
84
TID Transaction time Product
1 01-13-2014 20:04 Apple
1 01-13-2014 20:04 Cereal
1 01-13-2014 20:04 Diapers
2 01-14-2014 11:30 Beer
2 01-14-2014 11:30 Cereal
2 01-14-2014 11:30 Eggs
3 01-15-2014 14:30 Apple
3 01-15-2014 14:30 Beer
3 01-15-2014 14:30 Cereal
3 01-15-2014 14:30 Eggs
4 01-16-2014 14:15 Beer
4 01-16-2014 14:15 Eggs
Transaction ID Items
1 Apple, Cereal, Diapers
2 Beer, Cereal, Eggs
3 Apple, Beer, Cereal, Eggs
4 Beer, Eggs
http://dataminingtrend.com http://facebook.com/datacube.th
Market Basket Analysis
• Support
• นับจำนวนครั้งการซื้อสินค้าแต่ละชนิดคิดเป็น % ของการซื้อสินค้า
• Apple พบว่ามีการซื้อในครั้งที่ 1 และ 3 support(Apple) คือ 2/4 = 50%
• Beer พบว่ามีการซื้อในครั้งที่ 2, 3 และ 4 support(Beer) คือ 3/4 = 75%
85
Transaction ID Items
1 Apple, Cereal, Diapers
2 Beer, Cereal, Eggs
3 Apple, Beer, Cereal, Eggs
4 Beer, Eggs
Items
Transaction ID
Support
1 2 3 4
Apple 1 0 1 0 2/4 = 50%
Beer 0 1 1 1 3/4 = 75%
Cereal 1 1 1 0 3/4 = 75%
Diapers 1 0 0 0 1/4 = 25%
Eggs 0 1 1 1 3/4 = 75%
http://dataminingtrend.com http://facebook.com/datacube.th
Market Basket Analysis
• frequent itemset
• รูปแบบของการซื้อสินค้า (itemset) ที่มีค่า support > mininum support
• กำหนดค่า minimum support = 50% ตัวอย่างของ Frequent Itemset คือ
{Apple}, {Beer}, {Cereal}, {Eggs}
• infrequent itemset
• รูปแบบของการซื้อสินค้า (itemset) ที่มีค่า support < mininum support
86
Transaction ID Items
1 Apple, Cereal, Diapers
2 Beer, Cereal, Eggs
3 Apple, Beer, Cereal, Eggs
4 Beer, Eggs
Items
Transaction ID
Support
1 2 3 4
Apple 1 0 1 0 2/4 = 50%
Beer 0 1 1 1 3/4 = 75%
Cereal 1 1 1 0 3/4 = 75%
Diapers 1 0 0 0 1/4 = 25%
Eggs 0 1 1 1 3/4 = 75%
http://dataminingtrend.com http://facebook.com/datacube.th
Market Basket Analysis
• สินค้าใน supermarket มีจำนวน 3 ชนิด
• Apple, Beer, Cereal
• มีโอกาสที่เป็นไปได้ทั้งหมด (หรือ subset ทั้งหมด) คือ 23-1 = 7 รูปแบบ หรือ
คำนวณได้จาก 2N-1 โดยที่ N คือ จำนวนของสินค้า (item)
87
CerealApple
Apple, Cereal
Beer
Beer, CerealApple, Beer
Apple, Beer, Cereal
http://dataminingtrend.com http://facebook.com/datacube.th
Market Basket Analysis
• การหากฏความสัมพันธ์ (association rules) มี 2 ขั้นตอนใหญ่ๆ
• ขั้นตอนที่ 1 หา frequent itemset ซึ่งใช้เวลานานกว่าขั้นตอนที่ 2
• มี 2 เทคนิคที่นิยมใช้ คือ
• เทคนิค Apriori
• เทคนิค FP-Growth
• ขั้นตอนที่ 2 สร้างกฏความสัมพันธ์จาก frequent itemset ที่หาได้จากขั้นตอนที่ 1
88
http://dataminingtrend.com http://facebook.com/datacube.th
Market Basket Analysis
• เทคนิคการหากฏความสัมพันธ์ (Association Rules)
• Apriori (Agrawal and Srikant, 1994)
• สร้างรูปแบบของสินค้า (itemset) ที่มีจำนวนเพิ่มขึ้นทีละ 1
• คำนวณค่า support จากในฐานข้อมูล
• ข้อเสียคือต้องดึงข้อมูลจากฐานข้อมูลหลายรอบทำให้ทำงานช้า
• FP-Growth (Han, Pei and Yin, 2000)
• อ่านข้อมูลในฐานข้อมูลและสร้าง FP-tree
• คำนวณค่า support จาก FP-tree
• ทำงานได้เร็วกว่าวิธี Apriori
89
• J. Han, H. Pei, and Y. Yin. Mining Frequent Patterns without Candidate Generation. In: Proc. Conf. on the Management of Data
(SIGMOD’00, Dallas, TX). ACM Press, New York, NY, USA 2000
• R. Agrawal and R. Srikant, Fast algorithms for mining association rules in large databases, Proceedings of the 20th International
Conference on Very Large Data Bases, VLDB, pages 487-499, Santiago, Chile, September 1994
http://dataminingtrend.com http://facebook.com/datacube.th
• รูปแบบ (pattern) ที่มีสินค้า 2 ชนิด
• รูปแบบที่มี Apple อยู่
Apriori
90
Apple
{Apple, Beer}
Beer
Cereal
Eggs
Items
Transaction ID
Support
1 2 3 4
Apple 1 0 1 0 2/4 = 50%
Beer 0 1 1 1 3/4 = 75%
Itemset
Transaction ID
Support
1 2 3 4
{Apple, Beer} 0 0 1 0 1/4 = 25%
http://dataminingtrend.com http://facebook.com/datacube.th
• รูปแบบ (pattern) ที่มีสินค้า 2 ชนิด
• รูปแบบที่มี Cereal อยู่
Apriori
91
{Cereal, Eggs}
Items
Transaction ID
Support
1 2 3 4
Cereal 1 1 1 0 3/4 = 75%
Eggs 0 1 1 1 3/4 = 75%
Itemset
Transaction ID
Support
1 2 3 4
{Cereal, Eggs} 0 1 1 0 2/4 = 50%
Apple
Eggs
Cereal
Beer
http://dataminingtrend.com http://facebook.com/datacube.th
Apriori
• นับจำนวนครั้งการซื้อสินค้า 2 ชนิด
• {Apple, Beer}, {Apple, Cereal}, {Apple, Eggs}
• {Beer, Cereal}, {Beer, Eggs}
• {Cereal, Eggs}
92
Itemset
Transaction ID
Support
1 2 3 4
{Apple, Beer} 0 0 1 0 1/4 = 25%
{Apple, Cereal} 1 0 1 0 2/4 = 50%
{Apple, Eggs} 0 0 1 0 1/4 = 25%
{Beer, Cereal} 0 1 1 0 2/4 = 50%
{Beer, Eggs} 0 1 1 1 3/4 = 75%
{Cereal, Eggs} 0 1 1 0 2/4 = 50%
Itemset
Transaction ID
Support
1 2 3 4
{Apple, Beer} 0 0 1 0 1/4 = 25%
{Apple, Cereal} 1 0 1 0 2/4 = 50%
{Apple, Eggs} 0 0 1 0 1/4 = 25%
{Beer, Cereal} 0 1 1 0 2/4 = 50%
{Beer, Eggs} 0 1 1 1 3/4 = 75%
{Cereal, Eggs} 0 1 1 0 2/4 = 50%
Apple
Beer
Cereal
Eggs
Apple
Beer
Cereal
Eggs
http://dataminingtrend.com http://facebook.com/datacube.th
Apriori
• สินค้าที่มีการซื้อมากกว่าหรือเท่ากับ 50% เรียกว่า frequent itemset
93
Frequent itemset Support Size
{Apple} 2/4 = 50% 1
{Beer} 3/4 = 75% 1
{Cereal} 3/4 = 75% 1
{Eggs} 3/4 = 75% 1
{Apple, Cereal} 2/4 = 50% 2
{Beer, Cereal} 2/4 = 50% 2
{Beer, Eggs} 3/4 = 75% 2
{Cereal, Eggs} 2/4 = 50% 2
{Beer, Cereal, Eggs} 2/4 = 50% 3
http://dataminingtrend.com http://facebook.com/datacube.th
FP-Growth
• ขั้นตอนที่ 1 สร้าง compact data structure ที่เรียกว่า FP-tree
• การสร้าง FP-Tree อ่านข้อมูลจากฐานข้อมูลเพียงแค่ 2 ครั้งเท่านั้น
• หาค่า support ของรูปแบบการซื้อสินค้า (item) ที่มีความยาว 1
• เรียงลำดับตามค่า support ที่คำนวณได้
• สร้าง FP-Tree จากการอ่านข้อมูลในฐานข้อมูลเพียงหนึ่งรอบ
94
Transaction ID Items
1 Cereal, Apple, Diapers
2 Beer, Cereal, Eggs
3 Beer, Cereal, Eggs, Apple
4 Beer, Eggs
Cereal:1
NULL
Item support 

count
http://dataminingtrend.com http://facebook.com/datacube.th
FP-Growth
• ขั้นตอนที่ 1 สร้าง compact data structure ที่เรียกว่า FP-tree
• การสร้าง FP-Tree อ่านข้อมูลจากฐานข้อมูลเพียงแค่ 2 ครั้งเท่านั้น
• หาค่า support ของรูปแบบการซื้อสินค้า (item) ที่มีความยาว 1
• เรียงลำดับตามค่า support ที่คำนวณได้
• สร้าง FP-Tree จากการอ่านข้อมูลในฐานข้อมูลเพียงหนึ่งรอบ
95
Transaction ID Items
1 Cereal, Apple, Diapers
2 Beer, Cereal, Eggs
3 Beer, Cereal, Eggs, Apple
4 Beer, Eggs
Cereal:1
NULL
Apple:1
http://dataminingtrend.com http://facebook.com/datacube.th
FP-Growth
• ขั้นตอนที่ 1 สร้าง compact data structure ที่เรียกว่า FP-tree
• การสร้าง FP-Tree อ่านข้อมูลจากฐานข้อมูลเพียงแค่ 2 ครั้งเท่านั้น
• หาค่า support ของรูปแบบการซื้อสินค้า (item) ที่มีความยาว 1
• เรียงลำดับตามค่า support ที่คำนวณได้
• สร้าง FP-Tree จากการอ่านข้อมูลในฐานข้อมูลเพียงหนึ่งรอบ
96
Transaction ID Items
1 Cereal, Apple, Diapers
2 Beer, Cereal, Eggs
3 Beer, Cereal, Eggs, Apple
4 Beer, Eggs
Diapers:1
Cereal:1
NULL
Apple:1
http://dataminingtrend.com http://facebook.com/datacube.th
Apriori & FP-Growth
97
Frequent itemset Support
{Apple} 2/4 = 50%
{Apple, Cereal} 2/4 = 50%
{Eggs} 3/4 = 75%
{Cereal, Eggs} 2/4 = 50%
{Beer, Eggs} 3/4 = 75%
{Beer, Cereal, Eggs} 2/4 = 50%
{Cereal} 3/4 = 75%
{Beer, Cereal} 2/4 = 50%
{Beer} 3/4 = 75%
Frequent itemset Support
{Apple} 2/4 = 50%
{Beer} 3/4 = 75%
{Cereal} 3/4 = 75%
{Eggs} 3/4 = 75%
{Apple, Cereal} 2/4 = 50%
{Beer, Cereal} 2/4 = 50%
{Beer, Eggs} 3/4 = 75%
{Cereal, Eggs} 2/4 = 50%
{Beer, Cereal, Eggs} 2/4 = 50%
ผลลัพธ์จาก Apriori ผลลัพธ์จาก FP-Growth
http://dataminingtrend.com http://facebook.com/datacube.th
Association rules
• กฏความสัมพันธ์ (association rules)
• สร้างจากสินค้าที่ลูกค้าซื้อบ่อยๆ
• รูปแบบของกฏความสัมพันธ์ คือ
• LHS คือ Left Hand Side สินค้าที่ซื้อพร้อมกันบ่อยๆ ด้านซ้ายของกฏ
• RHS คือ Right Hand Side สินค้าที่ซื้อพร้อมกันบ่อยๆ ด้านขวาของกฏ
98
Frequent itemset Support Size
{Apple, Cereal} 2/4 = 50% 2
{Beer, Cereal} 2/4 = 50% 2
{Beer, Eggs} 3/4 = 75% 2
{Cereal, Eggs} 2/4 = 50% 2
{Beer, Cereal, Eggs} 2/4 = 50% 3
LHS RHS
Apple Cereal
Beer Eggs
Eggs Beer
Cereal Apple
Beer Cereal
Cereal Eggs
Cereal, Eggs Beer
http://dataminingtrend.com http://facebook.com/datacube.th
Association rules
• ตัววัดประสิทธิภาพของกฏความสัมพันธ์
• Confidence
• แสดงความเชื่อมั่นของกฏความสัมพันธ์ที่เมื่อรูปแบบ LHS เกิดขึ้นแล้วรูปแบบ RHS จะ
เกิดขึ้นด้วยเป็นจำนวนกี่เปอร์เซ็นต์
99
confidence(LHS RHS) = support(LHS, RHS)
support(LHS)
confidence(Apple Cereal) = support(Apple, Cereal)
support(Apple)
= 2/4
2/4
= 100%
http://dataminingtrend.com http://facebook.com/datacube.th
• โหลดไฟล์ pos.csv จาก thumb drive เข้าไปใน Repositories
• แปลงข้อมูลจาก POS database เป็นตาราง
TID Transaction time Product
1 01-13-2014 20:04 Apple
1 01-13-2014 20:04 Cereal
1 01-13-2014 20:04 Diapers
2 01-14-2014 11:30 Beer
2 01-14-2014 11:30 Cereal
2 01-14-2014 11:30 Eggs
3 01-15-2014 14:30 Apple
3 01-15-2014 14:30 Beer
3 01-15-2014 14:30 Cereal
3 01-15-2014 14:30 Eggs
4 01-16-2014 14:15 Beer
4 01-16-2014 14:15 Eggs
TID Apple Beer Cereal Diapers Eggs
1 TRUE FALSE TRUE TRUE FALSE
2 FALSE TRUE TRUE FALSE TRUE
3 TRUE TRUE TRUE FALSE TRUE
4 FALSE TRUE FALSE FALSE TRUE
Data preparation in RM 7
100
http://dataminingtrend.com http://facebook.com/datacube.th
Data preparation in RM 7
• โอเปอเรเตอร์ที่เกี่ยวข้อง
101
โอเปอเรเตอร์ คำอธิบาย
Retrieve ใช้สำหรับดึงข้อมูลออกมาจาก Repositories
Pivot ใช้สำหรับสร้างตารางในรูปแบบ Pivot
Numerical to
Binominal ใช้สำหรับแปลงข้อมูลตัวเลขให้เป็นประเภท Binominal
http://dataminingtrend.com http://facebook.com/datacube.th
Data preparation in RM 7
• เปลี่ยนพารามิเตอร์ของโอเปอเรเตอร์ Pivot ดังนี้
• group attribute เป็นค่า id
• index attribute เป็นค่า name
102
1
3
4
2
facebook.com/datacube.th
http://dataminingtrend.com http://facebook.com/datacube.th
Data preparation in RM 7
• เลือกโอเปอเรเตอร์ Numerical to Binominal มาใส่ใน Process
• เนื่องจากการหากฏความสัมพันธ์ไม่สามารถทำงานกับตัวเลข (numeric) ได้ครับ
• เพื่อแปลงข้อมูลตัวเลข ให้เป็นค่า TRUE/FALSE
103
5
3
4
6
facebook.com/datacube.th
http://dataminingtrend.com http://facebook.com/datacube.th
Data preparation in RM 7
• ผลการแปลงจาก POS database
104
facebook.com/datacube.th
http://dataminingtrend.com http://facebook.com/datacube.th
Association rules in RM 7
• โอเปอเรเตอร์ที่เกี่ยวข้อง
105
โอเปอเรเตอร์ คำอธิบาย
FP-Growth ใช้สำหรับหา frequent itemset ด้วยเทคนิค FP-Growth
Create Association
Rules
ใช้สำหรับสร้างกฏความสัมพันธ์จาก frequent itemset ที่
ค้นพบ
http://dataminingtrend.com http://facebook.com/datacube.th
Association rules in RM 7
• ใช้ข้อมูลที่แปลงได้เพื่อหากฏความสัมพันธ์
• ใช้โอเปอเรเตอร์ FP-Growth เพื่อหา frequent itemset
• เปลี่ยนพารามิเตอร์ min support เป็น 0.5 หรือ 50%
106
7
8
9
facebook.com/datacube.th
http://dataminingtrend.com http://facebook.com/datacube.th
Association rules in RM 7
• ใช้โอเปอเรเตอร์ Create Association Rules เพื่อสร้างกฏ

ความสัมพันธ์
• เปลี่ยนพารามิเตอร์ min confidence เป็น 0.6 หรือ 60%
107
12
11
10
facebook.com/datacube.th
http://dataminingtrend.com http://facebook.com/datacube.th
Association rules in RM 7
• แสดง frequent itemset ที่หาได้
108
ส่วน filter
ส่วน frequent itemset
คลิกที่ header ของแต่ละ
คอลัมน์เพื่อ sort
http://dataminingtrend.com http://facebook.com/datacube.th
Association rules in RM 7
• แสดงกฏความสัมพันธ์ที่หาได้
109
ส่วน filter
ส่วนแสดงกฏความสัมพันธ์
Clustering
Chapter 6
http://dataminingtrend.com http://facebook.com/datacube.th
Vegetables
• ภาพของผักชนิดต่างๆ
111
image source: http://kachabazaar.com/
http://dataminingtrend.com http://facebook.com/datacube.th
Vegetables
• แบ่งกลุ่มตามสีของผัก
112
ผักสีเขียว ผักที่ไม่ใช่สีเขียว
image source: http://kachabazaar.com/
http://dataminingtrend.com http://facebook.com/datacube.th
Vegetables
• แบ่งตามรูปร่างของผัก
113
รูปทรงกลม รูปทรงแท่ง
image source: http://kachabazaar.com/
http://dataminingtrend.com http://facebook.com/datacube.th
Customer profile
• การใช้งานโทรศัพท์มือถือของลูกค้า
114
1
2
3
5
6
4
image source: http://www.iconarchive.com/show/vista-people-icons-by-icons-land.html
http://dataminingtrend.com http://facebook.com/datacube.th
Customer profile
• หลังจากทำการแบ่งกลุ่มลูกค้าตามพฤติกรรมการใช้งาน
115
1 6
4 5
2 3
ลูกค้าที่ใช้โทรเยอะ
ลูกค้าที่ส่ง SMS เยอะ
ลูกค้าที่ใช้งานไม่เยอะ
image source: http://www.iconarchive.com/show/vista-people-icons-by-icons-land.html
http://dataminingtrend.com http://facebook.com/datacube.th
• Clustering คือ การแบ่งกลุ่มข้อมูล
• ข้อมูลที่มีลักษณะคล้ายๆ กัน อยู่กลุ่มเดียวกัน
• ข้อมูลที่อยู่คนละกลุ่มจะมีลักษณะที่แตกต่างกันมากๆ
• แต่ละกลุ่มจะเรียกว่า คลัสเตอร์ (cluster)
What is clustering?
116
คลัสเตอร์ 1
คลัสเตอร์ 2
คลัสเตอร์ 3
http://dataminingtrend.com http://facebook.com/datacube.th
• การจัดข้อมูลให้อยู่ในกลุ่มต่างๆ จะต้องมีการวัดค่าความคล้าย

คลึง (similarity) หรือ ค่าระยะห่าง (distance) ระหว่างข้อมูลแต่ละตัว
• ค่าระยะห่างที่นิยมใช้
• ระยะห่างยูคลิเดียน (Euclidean distance)
• ผมรวมของระยะห่างกำลังสอง
A
Distance function
117
Euclidean distance = √(XB - XA)2 + (YB - YA)2
B
(XB,YB)
(XA,YA)
(XB - XA)
(YB - YA)
http://dataminingtrend.com http://facebook.com/datacube.th
Clustering example
• ทำการ clustering ลูกค้าตามพฤติกรรมการใช้งาน SMS และ 

Phone
118
ID SMS Phone
1 27 144
2 32 44
3 41 30
4 125 21
5 105 23
6 20 121
20 40 60 80 100 120 140 160
20
40
SMS
Phone
60
80
100
120
140
160 ใช้ sms เยอะ
ใช้โทรศัพท์เยอะ
ใช้แบบทั่วไปd35
d16
1
3
2
4
5
6
http://dataminingtrend.com http://facebook.com/datacube.th
• กำหนด K = 3
• กำหนดให้ข้อมูลหมายเลข 1,3,5 เป็นจุดศูนย์กลางของแต่ละคลัสเตอร์
• คำนวณระยะห่างระหว่างจุดศูนย์กลางของคลัสเตอร์
12
K-Means
119
ID SMS Phone Center
1 27 144 X
2 32 44 -
3 41 30 X
4 125 21 -
5 105 23 X
6 20 121 -
20 40 60 80 100 120 140 160
20
40
SMS
Phone
60
80
100
120
140
160
d61
3
4
6
d21
d41
5
d65d25
d45
d43
d23
d63
http://dataminingtrend.com http://facebook.com/datacube.th
• ผลการแบ่งคลัสเตอร์
• คลัสเตอร์ที่ 1 ประกอบด้วยข้อมูลหมายเลข 1,6
• คลัสเตอร์ที่ 2 ประกอบด้วยข้อมูลหมายเลข 2,3
• คลัสเตอร์ที่ 3 ประกอบด้วยข้อมูลหมายเลข 4,5
K-Means
120
4
1
3
2
6
20 40 60 80 100 120 140 160
20
40
SMS
Phone
60
80
100
120
140
160
5
ใช้ sms เยอะ
ใช้โทรศัพท์เยอะใช้แบบทั่วไป
http://dataminingtrend.com http://facebook.com/datacube.th
K-Means
• แบ่งข้อมูลนี้ด้วยเทคนิค K-Means ออกเป็น 3 กลุ่ม
121
facebook.com/datacube.th
http://dataminingtrend.com http://facebook.com/datacube.th
K-Means
• ทำการสุ่มข้อมูล 3 ตัวเพื่อเป็นจุดศูนย์กลางของคลัสเตอร์
122
facebook.com/datacube.th
http://dataminingtrend.com http://facebook.com/datacube.th
• หาจุดศูนย์กลางของแต่ละคลัสเตอร์ใหม่อีกครั้ง
x
K-Means
123
x
x
จุดศูนย์กลางของคลัสเตอร์ 1
จุดศูนย์กลางของคลัสเตอร์ 2
จุดศูนย์กลางของคลัสเตอร์ 3
facebook.com/datacube.th
http://dataminingtrend.com http://facebook.com/datacube.th
• พบว่าข้อมูลไม่มีการเปลี่ยนกลุ่มจึงหยุดการทำงาน
K-Means
124
facebook.com/datacube.th
http://dataminingtrend.com http://facebook.com/datacube.th
Clustering validity
• การวัดประสิทธิภาพของ clustering
• ปรับเปลี่ยนจำนวนกลุ่มของคลัสเตอร์ (ค่า K)
• plot กราฟระหว่างจำนวนกลุ่มของคลัสเตอร์กับค่า Average within centroid distance
• จำนวนกลุ่มที่เหมาะสมคือจุดที่เป็น elbow point
125
K Avg within distance
2 2865.90
3 1605.40
4 1051.10
5 769.44
6 600.68
7 490.88
6 417.71
9 365.09
10 326.50
0.00
500.00
1000.00
1500.00
2000.00
2500.00
3000.00
จำนวนคลัสเตอร์ (K)
2 3 4 5 6 7 8 9 10
Averagewithincentroiddistance
elbow point
http://dataminingtrend.com http://facebook.com/datacube.th
K-Means in RM 7
• โหลดไฟล์ tel_usage.csv เข้าไปใน Repositories
126
1
2
http://dataminingtrend.com http://facebook.com/datacube.th
K-Means in RM 7
• โอเปอเรเตอร์ที่เกี่ยวข้องกับ K-Means
127
โอเปอเรเตอร์ คำอธิบาย
Retrieve ใช้สำหรับดึงข้อมูลออกมาจาก Repositories
K-Means ใช้สำหรับแบ่งกลุ่มข้อมูลด้วยเทคนิค K-Means
http://dataminingtrend.com http://facebook.com/datacube.th
K-Means in RM 7
• โหลด tel_usage จาก Repositories
• กำหนดจำนวนกลุ่มของ K-Means ให้เป็น 3 กลุ่ม
128
2
1
4
3
facebook.com/datacube.th
http://dataminingtrend.com http://facebook.com/datacube.th
K-Means in RM 7
• ผลการแบ่งกลุ่มข้อมูลออกเป็น 3 คลัสเตอร์
129
คลัสเตอร์
facebook.com/datacube.th
http://dataminingtrend.com http://facebook.com/datacube.th
K-Means in RM 7
• แสดงการกระจายตัวของข้อมูลในแต่ละคลัสเตอร์
130
6
7
ใช้โทรศัพท์เยอะ
ใช้ SMS เยอะ
ใช้แบบทั่วไป
facebook.com/datacube.th
http://dataminingtrend.com http://facebook.com/datacube.th
K-Means in RM 7
• แสดงจุดศูนย์กลางของแต่ละคลัสเตอร์ (centroid)
• บอกลักษณะรูปแบบของข้อมูลที่อยู่ในคลัสเตอร์นั้นๆ
131
8
จุดศูนย์กลางของคลัสเตอร์
facebook.com/datacube.th
http://dataminingtrend.com http://facebook.com/datacube.th
Clustering techniques
• เทคนิคที่นิยมใช้ในการทำ clustering
• K-Means
• เป็นประเภท partitional clustering
• Agglomerative Clustering
• เป็นประเภท hierarchical clustering
• DBSCAN — Density Based Spatial Clustering of Applications with Noise
• เป็นประเภท density-based clustering
132
http://dataminingtrend.com http://facebook.com/datacube.th
DBSCAN
• เป็นวิธีการทำ clustering ด้วยการพิจารณาจำนวนข้อมูลที่อยู่ใน

รัศมีที่กำหนด
• ช่วยแก้ปัญหาของ partitional clustering เช่น K-Means
133
ข้อมูล ผลการแบ่งคลัสเตอร์ด้วย K-Means
http://dataminingtrend.com http://facebook.com/datacube.th
DBSCAN
• ผลการแบ่งกลุ่มข้อมูลด้วยเทคนิค DBSCAN
134
ข้อมูล ผลการแบ่งคลัสเตอร์ด้วย DBSCAN
facebook.com/datacube.th
Classification
Chapter 7
http://dataminingtrend.com http://facebook.com/datacube.th
Classification in daily life
• การพยากรณ์อากาศ
136
สภาพอากาศวันปัจจุบัน สภาพอากาศวันถัดไป
http://dataminingtrend.com http://facebook.com/datacube.th
Classification in daily life
• speech recognition
137
image source: http://blog.spoken.com/ivr/
http://dataminingtrend.com http://facebook.com/datacube.th
Classification in daily life
• face recognition
138
image source: http://www.bloomberg.com/news/articles/2012-06-18/facebook-buys-face-com-adds-facial-recognition-software
http://dataminingtrend.com http://facebook.com/datacube.th
Classification in daily life
• spam e-mail
139
spam e-mail
http://dataminingtrend.com http://facebook.com/datacube.th
Classification example
• ตัวอย่าง spam e-mail classification
• ระบุว่า e-mail ไหนบ้างที่เป็น spam e-mail
140
ID Text Type
1
Please call our customer service representative on FREE PHONE 0808 145 4742 between
9am-11pm as you have WON a guaranteed £1000 cash
2 You have won $1,000 cash or a $2,000 prize! To claim, call 09050000327
3 I'm gonna be home soon and I don't want to talk about this stuff anymore tonight
4 Is that seriously how you spell his name?
5
Double mins and txts 4 6months FREE Bluetooth on Orange. Available on Sony, Nokia Motorola
phones.
6 FREE RINGTONE text FIRST to 87131 for a poly or text GET to 87131 for a true tone!
7 Sorry, I'll you call later in meeting.
8
Congratulations - in this week's competition draw u have won the £1450 prize to claim just call
09050002311
9 Thanks a lot for your wishes on my birthday. Thanks you for making my birthday truly memorable.
10 Hello, What are you doing? Did you attend the training course today?
spam
spam
normal
normal
normal
normal
spam
spam
spam
normal
http://dataminingtrend.com http://facebook.com/datacube.th
Classification example
• ตัวอย่าง spam e-mail classification
• ระบุว่า e-mail ไหนบ้างที่เป็น spam e-mail
141
ID Text Type
1
Please call our customer service representative on FREE PHONE 0808 145 4742 between
9am-11pm as you have WON a guaranteed £1000 cash
spam
2 You have won $1,000 cash or a $2,000 prize! To claim, call 09050000327 spam
3 I'm gonna be home soon and I don't want to talk about this stuff anymore tonight normal
4 Is that seriously how you spell his name? normal
5
Double mins and txts 4 6months FREE Bluetooth on Orange. Available on Sony, Nokia Motorola
phones.
spam
6 FREE RINGTONE text FIRST to 87131 for a poly or text GET to 87131 for a true tone! spam
7 Sorry, I'll you call later in meeting. normal
8
Congratulations - in this week's competition draw u have won the £1450 prize to claim just call
09050002311
spam
9 Thanks a lot for your wishes on my birthday. Thanks you for making my birthday truly memorable. normal
10 Hello, What are you doing? Did you attend the training course today? normal
http://dataminingtrend.com http://facebook.com/datacube.th
Classification example
• ตัวอย่าง spam e-mail classification
• หา keyword ที่ใช้บ่งบอกว่าเป็น spam e-mail
142
ID Free Won Cash Type
1 Y Y Y spam
2 N Y Y spam
3 N N N normal
4 N N N normal
5 Y N N spam
6 Y N N spam
7 N N N normal
8 N Y N spam
9 N N N normal
10 N N N normal
ID Text Type
1
Please call our customer service
representative on FREE PHONE 0808
145 4742 between 9am-11pm as you
have WON a guaranteed £1000 cash
spam
2
You have won $1,000 cash or a $2,000
prize! To claim, call 09050000327
spam
3
I'm gonna be home soon and I don't
want to talk about this stuff anymore
tonight
normal
4
Is that seriously how you spell his
name?
normal
5
Double mins and txts 4 6months FREE
Bluetooth on Orange. Available on
Sony, Nokia Motorola phones.
spam
… … …
keywords
http://dataminingtrend.com http://facebook.com/datacube.th
Classification example
• ตัวอย่าง spam e-mail classification
• สร้างโมเดล (classification model) จากข้อมูล training data ซึ่งมีลาเบล (label)
143
ID Free Won Cash Type
1 Y Y Y spam
2 N Y Y spam
3 N N N normal
4 N N N normal
5 Y N N spam
6 Y N N spam
7 N N N normal
8 N Y N spam
9 N N N normal
10 N N N normal
attribute label
Free
Won
Normal Spam
Spam
classification model
= N = Y
= N = Y
training data
http://dataminingtrend.com http://facebook.com/datacube.th
Classification example
• ตัวอย่าง spam e-mail classification
• นำข้อมูลใหม่ (unseen data) ทำนายโดยใช้โมเดล
144
attribute
Free
Won
Normal Spam
Spam
classification model
= N = Y
= N = Y
training data
ID Free Won Cash Type
11 Y Y N ?
12 N Y N ?
http://dataminingtrend.com http://facebook.com/datacube.th
Classification example
• ตัวอย่าง spam e-mail classification
• นำข้อมูลใหม่ (unseen data) ทำนายโดยใช้โมเดล
145
attribute
Free
Won
Normal Spam
Spam
classification model
= N = Y
= N = Y
training data
ID Free Won Cash Type
11 Y Y N ?
12 N Y N ?
http://dataminingtrend.com http://facebook.com/datacube.th
Classification example
• ตัวอย่าง spam e-mail classification
• นำข้อมูลใหม่ (unseen data) ทำนายโดยใช้โมเดล
146
attribute
Free
Won
Normal Spam
Spam
classification model
= N = Y
= N = Y
training data
ID Free Won Cash Type
11 Y Y N ?
12 N Y N ?
http://dataminingtrend.com http://facebook.com/datacube.th
• ตัวอย่าง spam e-mail classification
ID Free Won Cash Type
1 Y Y Y spam
2 N Y Y spam
3 N N N normal
4 N N N normal
5 Y N N spam
Classification example
147
attribute labelID
training data
สร้าง classification model
ID Free Won Cash Type
11 Y Y N ?
12 N Y N ?
unseen data
classification model
ID Type
11 spam
12 spam
1
2
3 4
http://dataminingtrend.com http://facebook.com/datacube.th
Classification & Regression
• การจำแนกประเภทข้อมูล (classification)
• นำข้อมูลเดิมที่มีคำตอบที่สนใจ หรือ คลาส (class) มาสร้างเป็นโมเดล (model) เพื่อ
หาคำตอบให้กับข้อมูลใหม่ (unseen data)
• คลาสคำตอบเป็น ประเภท (nominal)
• ฝนตก หรือ ไม่ตก
• spam email หรือ normal email
• การประมาณค่าข้อมูล (regression)
• มีลักษณะเหมือนกับ classification เพียงแต่คลาสคำตอบที่สนใจเป็น ตัวเลข
(numeric)
• อุณหภูมิในวันถัดไป
• ยอดขายในไตรมาสถัดไป
148
http://dataminingtrend.com http://facebook.com/datacube.th
• การสร้างโมเดลและการทดสอบประสิทธิภาพ
Classification & Regression task
149
สร้าง 

classification model
prediction results
classification model
ID Type Predicted
1 spam spam
2 spam spam
3 normal normal
1
training data
testing data
ID Free Won Cash Type
1 Y Y Y spam
2 N Y Y spam
3 N N N normal
ID Free Won Cash Type
1 Y Y Y spam
2 N Y Y spam
3 N N N normal
2
3 4
facebook.com/datacube.th
facebook.com/datacube.th
http://dataminingtrend.com http://facebook.com/datacube.th
Performance (classification)
• ตัววัดประสิทธิิภาพของโมเดล classification
• Confusion Matrix
• True Positive (TP), True Negative (TN)
• False Positive (FP), False Negative (FN)
• Precision and Recall
• Accuracy
• F-Measure
• ROC Graph & Area Under Curve (AUC)
150
http://dataminingtrend.com http://facebook.com/datacube.th
Performance (classification)
• พิจารณาคลาส normal
• True Positive (TP)
• True Negative (TN)
• False Positive (FP)
• False Negative (FN)
151
ID Type Predicted
1 spam spam
2 spam spam
3 normal normal
4 normal spam
5 spam spam
6 spam spam
7 normal spam
8 spam normal
9 normal normal
10 normal normal
11 spam spam
12 spam spam
13 spam normal
14 spam normal
15 normal normal
ID Type Predicted
1 spam spam
2 spam spam
3 normal normal
4 normal spam
5 spam spam
6 spam spam
7 normal spam
8 spam normal
9 normal normal
10 normal normal
11 spam spam
12 spam spam
13 spam normal
14 spam normal
15 normal normal
pred.true. normal spam
normal TP FP
spam FN TN
dataminingtrend.com
http://dataminingtrend.com http://facebook.com/datacube.th
Performance (classification)
• พิจารณาคลาส normal
• True Positive (TP)
• จำนวนที่ทำนายตรงกับข้อมูลจริงใน
คลาสที่กำลังพิจารณา
• True Negative (TN)
• False Positive (FP)
• False Negative (FN)
152
ID Type Predicted
1 spam spam
2 spam spam
3 normal normal
4 normal spam
5 spam spam
6 spam spam
7 normal spam
8 spam normal
9 normal normal
10 normal normal
11 spam spam
12 spam spam
13 spam normal
14 spam normal
15 normal normal
ID Type Predicted
1 spam spam
2 spam spam
3 normal normal
4 normal spam
5 spam spam
6 spam spam
7 normal spam
8 spam normal
9 normal normal
10 normal normal
11 spam spam
12 spam spam
13 spam normal
14 spam normal
15 normal normal
pred.true. normal spam
normal 4 FP
spam FN TN
dataminingtrend.com
http://dataminingtrend.com http://facebook.com/datacube.th
Performance (classification)
• พิจารณาคลาส normal
• True Positive (TP)
• True Negative (TN)
• จำนวนที่ทำนายตรงกับข้อมูลจริงใน
คลาสที่ไม่ได้กำลังพิจารณา
• False Positive (FP)
• False Negative (FN)
153
ID Type Predicted
1 spam spam
2 spam spam
3 normal normal
4 normal spam
5 spam spam
6 spam spam
7 normal spam
8 spam normal
9 normal normal
10 normal normal
11 spam spam
12 spam spam
13 spam normal
14 spam normal
15 normal normal
ID Type Predicted
1 spam spam
2 spam spam
3 normal normal
4 normal spam
5 spam spam
6 spam spam
7 normal spam
8 spam normal
9 normal normal
10 normal normal
11 spam spam
12 spam spam
13 spam normal
14 spam normal
15 normal normal
pred.true. normal spam
normal 4 FP
spam FN 6
dataminingtrend.com
http://dataminingtrend.com http://facebook.com/datacube.th
Performance (classification)
• พิจารณาคลาส normal
• True Positive (TP)
• True Negative (TN)
• False Positive (FP)
• จำนวนที่ทำนายผิดเป็นคลาสที่กำลัง
พิจารณา
• False Negative (FN)
154
ID Type Predicted
1 spam spam
2 spam spam
3 normal normal
4 normal spam
5 spam spam
6 spam spam
7 normal spam
8 spam normal
9 normal normal
10 normal normal
11 spam spam
12 spam spam
13 spam normal
14 spam normal
15 normal normal
ID Type Predicted
1 spam spam
2 spam spam
3 normal normal
4 normal spam
5 spam spam
6 spam spam
7 normal spam
8 spam normal
9 normal normal
10 normal normal
11 spam spam
12 spam spam
13 spam normal
14 spam normal
15 normal normal
pred.true. normal spam
normal 4 3
spam FN 6
dataminingtrend.com
http://dataminingtrend.com http://facebook.com/datacube.th
Performance (classification)
• พิจารณาคลาส normal
• True Positive (TP)
• True Negative (TN)
• False Positive (FP)
• False Negative (FN)
• จำนวนที่ทำนายผิดเป็นคลาสที่ไม่ได้
กำลังพิจารณา
155
ID Type Predicted
1 spam spam
2 spam spam
3 normal normal
4 normal spam
5 spam spam
6 spam spam
7 normal spam
8 spam normal
9 normal normal
10 normal normal
11 spam spam
12 spam spam
13 spam normal
14 spam normal
15 normal normal
ID Type Predicted
1 spam spam
2 spam spam
3 normal normal
4 normal spam
5 spam spam
6 spam spam
7 normal spam
8 spam normal
9 normal normal
10 normal normal
11 spam spam
12 spam spam
13 spam normal
14 spam normal
15 normal normal
pred.true. normal spam
normal 4 3
spam 2 6
dataminingtrend.com
http://dataminingtrend.com http://facebook.com/datacube.th
Performance (classification)
• ตัววัดประสิทธิิภาพของโมเดล classification
• Confusion Matrix
• True Positive (TP), True Negative (TN)
• False Positive (FP), False Negative (FN)
• Precision and Recall
• F-Measure
• Accuracy
• ROC Graph & Area Under Curve (AUC)
156
http://dataminingtrend.com http://facebook.com/datacube.th
Performance (classification)
• Precision
• จำนวนที่ทำนายถูกจากข้อมูลที่
ทำนายว่าเป็นคลาสที่พิจารณาอยู่
• Precision สำหรับ normal
• True Positive

True Positive + False Positive
• 4/7 x 100 = 57.12%
• Precision สำหรับ spam
• 6/8 x 100 = 75%
157
ID Type Predicted
3 normal normal
8 spam normal
9 normal normal
10 normal normal
13 spam normal
14 spam normal
15 normal normal
pred.true. normal spam
normal TP FP
spam FN TN
Precision
ID Type Predicted
1 spam spam
2 spam spam
4 normal spam
5 spam spam
6 spam spam
7 normal spam
11 spam spam
12 spam spam
predict เป็นคลาส spam
predict เป็นคลาส normal
confusion matrix ของคลาส normal
http://dataminingtrend.com http://facebook.com/datacube.th
Performance (classification)
• Recall
• จำนวนข้อมูลที่ทำนายถูก
• Recall สำหรับ normal
• True Positive

True Positive + False Negative
• 4/6 x 100 = 66.67%
• Recall สำหรับ spam
• 7/9 x 100 = 77.78%
158
pred.true. normal spam
normal TP FP
spam FN TN
คลาส spam
คลาส normal
confusion matrix ของคลาส normal
Recall
ID Type Predicted
3 normal normal
4 normal spam
7 normal spam
9 normal normal
10 normal normal
15 normal normal
ID Type Predicted
1 spam spam
2 spam spam
5 spam spam
6 spam spam
8 spam normal
11 spam spam
12 spam spam
13 spam normal
14 spam spam
http://dataminingtrend.com http://facebook.com/datacube.th
Performance (classification)
• ตัววัดประสิทธิิภาพของโมเดล classification
• Confusion Matrix
• True Positive (TP), True Negative (TN)
• False Positive (FP), False Negative (FN)
• Precision and Recall
• F-Measure
• Accuracy
• ROC Graph & Area Under Curve (AUC)
159
http://dataminingtrend.com http://facebook.com/datacube.th
Performance (classification)
• F-Measure
• ค่าเฉลี่ยของ Precision และ Recall
• 2 x Precision x Recall 

Precision + Recall
• F-Measure สำหรับ normal
• 2 x 57.12 x 66.67 = 61.53%

57.12 + 66.67
• F-Measure สำหรับ spam
• 2 x 75 x 77.8 = 76.37%

75 + 77.8
160
ID Type Predicted
3 normal normal
8 spam normal
9 normal normal
10 normal normal
13 spam normal
14 spam normal
15 normal normal
Precision = 4/7 x 100 = 57.12%
Recall = 4/6 x 100 = 66.67%
ID Type Predicted
3 normal normal
4 normal spam
7 normal spam
9 normal normal
10 normal normal
15 normal normal
http://dataminingtrend.com http://facebook.com/datacube.th
Performance (classification)
• ตัววัดประสิทธิิภาพของโมเดล classification
• Confusion Matrix
• True Positive (TP), True Negative (TN)
• False Positive (FP), False Negative (FN)
• Precision and Recall
• F-Measure
• Accuracy
• ROC Graph & Area
161
http://dataminingtrend.com http://facebook.com/datacube.th
Performance (classification)
• Accuracy
• จำนวนข้อมูลที่ทำนายถูกของทุก

คลาส
• True Positive + True Negative

True Positive + True Negative + False Positive + False Negative
• 10/15 x 100 =66.67%
162
pred.true. normal spam
normal TP FP
spam FN TN
Accuracy
ID Type Predicted
1 spam spam
2 spam spam
3 normal normal
4 normal spam
5 spam spam
6 spam spam
7 normal spam
8 spam normal
9 normal normal
10 normal normal
11 spam spam
12 spam spam
13 spam normal
14 spam normal
15 normal normal
dataminingtrend.com
http://dataminingtrend.com http://facebook.com/datacube.th
Performance (classification)
• ตัววัดประสิทธิิภาพของโมเดล classification
• Confusion Matrix
• True Positive (TP), True Negative (TN)
• False Positive (FP), False Negative (FN)
• Precision and Recall
• F-Measure
• Accuracy
• ROC Graph & Area Under Curve (AUC)
163
http://dataminingtrend.com http://facebook.com/datacube.th
ROC Graph & Area
• Receiver Operating Characteristics (ROC) แสดงกราฟความ
สัมพันธ์ระหว่างข้อมูลที่ทำนายถูก (แกน Y) และทำนายผิด (แกน X)
164
ID Type Predicted Score TP rate FP rate
1 normal spam 0.80 1.00 1.00
2 spam spam 0.85 1.00 0.66
4 normal spam 0.87 0.80 0.66
5 spam spam 0.90 0.80 0.33
6 spam spam 0.92 0.60 0.33
7 normal spam 0.95 0.40 0.33
11 spam spam 0.95 0.40 0.00
12 spam spam 0.99 0.20 0.00
0.1 0.3 0.4 0.5 0.6 0.7
0.1
0.2
False Positive Rate (FP rate)
0.3
0.4
0.5
0.6
0.7
True Positive rate (TP rate)
0.2
0.8
0.9
1.0
0.8 0.9 1.0
http://dataminingtrend.com http://facebook.com/datacube.th
ROC Graph & Area
• Receiver Operating Characteristics (ROC) แสดงกราฟความ
สัมพันธ์ระหว่างข้อมูลที่ทำนายถูก (แกน Y) และทำนายผิด (แกน X)
165
ID Type Predicted Score TP rate FP rate
1 normal spam 0.80 1.00 1.00
2 spam spam 0.85 1.00 0.66
4 normal spam 0.87 0.80 0.66
5 spam spam 0.90 0.80 0.33
6 spam spam 0.92 0.60 0.33
7 normal spam 0.95 0.40 0.33
11 spam spam 0.98 0.40 0.00
12 spam spam 0.99 0.20 0.00
0.1 0.3 0.4 0.5 0.6 0.7
0.1
0.2
False Positive Rate (FP rate)
0.3
0.4
0.5
0.6
0.7
True Positive rate (TP rate)
0.2
0.8
0.9
1.0
0.8 0.9 1.0
http://dataminingtrend.com http://facebook.com/datacube.th
ROC Graph & Area
• Receiver Operating Characteristics (ROC) แสดงกราฟความ
สัมพันธ์ระหว่างข้อมูลที่ทำนายถูก (แกน Y) และทำนายผิด (แกน X)
166
ID Type Predicted Score TP rate FP rate
1 normal spam 0.80 1.00 1.00
2 spam spam 0.85 1.00 0.66
4 normal spam 0.87 0.80 0.66
5 spam spam 0.90 0.80 0.33
6 spam spam 0.92 0.60 0.33
7 normal spam 0.95 0.40 0.33
11 spam spam 0.98 0.40 0.00
12 spam spam 0.99 0.20 0.00
0.1 0.3 0.4 0.5 0.6 0.7
0.1
0.2
False Positive Rate (FP rate)
0.3
0.4
0.5
0.6
0.7
True Positive rate (TP rate)
0.2
0.8
0.9
1.0
0.8 0.9 1.0
http://dataminingtrend.com http://facebook.com/datacube.th
ROC Graph & Area
• Receiver Operating Characteristics (ROC) แสดงกราฟความ
สัมพันธ์ระหว่างข้อมูลที่ทำนายถูก (แกน Y) และทำนายผิด (แกน X)
167
ID Type Predicted Score TP rate FP rate
1 normal spam 0.80 1.00 1.00
2 spam spam 0.85 1.00 0.66
4 normal spam 0.87 0.80 0.66
5 spam spam 0.90 0.80 0.33
6 spam spam 0.92 0.60 0.33
7 normal spam 0.95 0.40 0.33
11 spam spam 0.98 0.40 0.00
12 spam spam 0.99 0.20 0.00
0.1 0.3 0.4 0.5 0.6 0.7
0.1
0.2
False Positive Rate (FP rate)
0.3
0.4
0.5
0.6
0.7
True Positive rate (TP rate)
0.2
0.8
0.9
1.0
0.8 0.9 1.0
http://dataminingtrend.com http://facebook.com/datacube.th
ROC Graph & Area
• Receiver Operating Characteristics (ROC) แสดงกราฟความ
สัมพันธ์ระหว่างข้อมูลที่ทำนายถูก (แกน Y) และทำนายผิด (แกน X)
168
ID Type Predicted Score TP rate FP rate
1 normal spam 0.80 1.00 1.00
2 spam spam 0.85 1.00 0.66
4 normal spam 0.87 0.80 0.66
5 spam spam 0.90 0.80 0.33
6 spam spam 0.92 0.60 0.33
7 normal spam 0.95 0.40 0.33
11 spam spam 0.98 0.40 0.00
12 spam spam 0.99 0.20 0.00
0.1 0.3 0.4 0.5 0.6 0.7
0.1
0.2
False Positive Rate (FP rate)
0.3
0.4
0.5
0.6
0.7
True Positive rate (TP rate)
0.2
0.8
0.9
1.0
0.8 0.9 1.0
http://dataminingtrend.com http://facebook.com/datacube.th
ROC Graph & Area
• Receiver Operating Characteristics (ROC) แสดงกราฟความ
สัมพันธ์ระหว่างข้อมูลที่ทำนายถูก (แกน Y) และทำนายผิด (แกน X)
169
ID Type Predicted Score TP rate FP rate
1 normal spam 0.80 1.00 1.00
2 spam spam 0.85 1.00 0.66
4 normal spam 0.87 0.80 0.66
5 spam spam 0.90 0.80 0.33
6 spam spam 0.92 0.60 0.33
7 normal spam 0.95 0.40 0.33
11 spam spam 0.98 0.40 0.00
12 spam spam 0.99 0.20 0.00
0.1 0.3 0.4 0.5 0.6 0.7
0.1
0.2
False Positive Rate (FP rate)
0.3
0.4
0.5
0.6
0.7
True Positive rate (TP rate)
0.2
0.8
0.9
1.0
0.8 0.9 1.0
http://dataminingtrend.com http://facebook.com/datacube.th
ROC Graph & Area
• Receiver Operating Characteristics (ROC) แสดงกราฟความ
สัมพันธ์ระหว่างข้อมูลที่ทำนายถูก (แกน Y) และทำนายผิด (แกน X)
170
ID Type Predicted Score TP rate FP rate
1 normal spam 0.80 1.00 1.00
2 spam spam 0.85 1.00 0.66
4 normal spam 0.87 0.80 0.66
5 spam spam 0.90 0.80 0.33
6 spam spam 0.92 0.60 0.33
7 normal spam 0.95 0.40 0.33
11 spam spam 0.98 0.40 0.00
12 spam spam 0.99 0.20 0.00
0.1 0.3 0.4 0.5 0.6 0.7
0.1
0.2
False Positive Rate (FP rate)
0.3
0.4
0.5
0.6
0.7
True Positive rate (TP rate)
0.2
0.8
0.9
1.0
0.8 0.9 1.0
http://dataminingtrend.com http://facebook.com/datacube.th
ROC Graph & Area
• Receiver Operating Characteristics (ROC) แสดงกราฟความ
สัมพันธ์ระหว่างข้อมูลที่ทำนายถูก (แกน Y) และทำนายผิด (แกน X)
171
ID Type Predicted Score TP rate FP rate
1 normal spam 0.80 1.00 1.00
2 spam spam 0.85 1.00 0.66
4 normal spam 0.87 0.80 0.66
5 spam spam 0.90 0.80 0.33
6 spam spam 0.92 0.60 0.33
7 normal spam 0.95 0.40 0.33
11 spam spam 0.98 0.40 0.00
12 spam spam 0.99 0.20 0.00
0.1 0.3 0.4 0.5 0.6 0.7
0.1
0.2
False Positive Rate (FP rate)
0.3
0.4
0.5
0.6
0.7
True Positive rate (TP rate)
0.2
0.8
0.9
1.0
0.8 0.9 1.0
http://dataminingtrend.com http://facebook.com/datacube.th
ROC Graph & Area
• Receiver Operating Characteristics (ROC) แสดงกราฟความ
สัมพันธ์ระหว่างข้อมูลที่ทำนายถูก (แกน Y) และทำนายผิด (แกน X)
172
ID Type Predicted Score TP rate FP rate
1 normal spam 0.80 1.00 1.00
2 spam spam 0.85 1.00 0.66
4 normal spam 0.87 0.80 0.66
5 spam spam 0.90 0.80 0.33
6 spam spam 0.92 0.60 0.33
7 normal spam 0.95 0.40 0.33
11 spam spam 0.98 0.40 0.00
12 spam spam 0.99 0.20 0.00
0.1 0.3 0.4 0.5 0.6 0.7
0.1
0.2
False Positive Rate (FP rate)
0.3
0.4
0.5
0.6
0.7
True Positive rate (TP rate)
0.2
0.8
0.9
1.0
0.8 0.9 1.0
ROC Curve
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate
Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate

Contenu connexe

Tendances

คู่มือ practical data mining with rapid miner studio7
คู่มือ practical data mining with rapid miner studio7คู่มือ practical data mining with rapid miner studio7
คู่มือ practical data mining with rapid miner studio7Pitchayanida Khumwichai
 
วิทยาการคำนวณ ม.5 - บทที่ 1 ข้อมูลมีคุณค่า
วิทยาการคำนวณ ม.5 - บทที่ 1 ข้อมูลมีคุณค่าวิทยาการคำนวณ ม.5 - บทที่ 1 ข้อมูลมีคุณค่า
วิทยาการคำนวณ ม.5 - บทที่ 1 ข้อมูลมีคุณค่าCoco Tan
 
กฎหมายคุ้มครองข้อมูลส่วนบุคคลกับบริบทการคุ้มครองข้อมูลส่วนบุคคลในกฎหมายอื่น
กฎหมายคุ้มครองข้อมูลส่วนบุคคลกับบริบทการคุ้มครองข้อมูลส่วนบุคคลในกฎหมายอื่นกฎหมายคุ้มครองข้อมูลส่วนบุคคลกับบริบทการคุ้มครองข้อมูลส่วนบุคคลในกฎหมายอื่น
กฎหมายคุ้มครองข้อมูลส่วนบุคคลกับบริบทการคุ้มครองข้อมูลส่วนบุคคลในกฎหมายอื่นETDAofficialRegist
 
แนวทางการบริหารจัดการบริการทันตกรรม Fee schedule dental 2563
แนวทางการบริหารจัดการบริการทันตกรรม Fee schedule dental 2563แนวทางการบริหารจัดการบริการทันตกรรม Fee schedule dental 2563
แนวทางการบริหารจัดการบริการทันตกรรม Fee schedule dental 2563Sakarin Habusaya
 
คู่มือ ลดพุง ลดโรค ฉบับประชาชน
คู่มือ ลดพุง ลดโรค ฉบับประชาชนคู่มือ ลดพุง ลดโรค ฉบับประชาชน
คู่มือ ลดพุง ลดโรค ฉบับประชาชนUtai Sukviwatsirikul
 
บทที่ 1 ความรู้เกี่ยวกับพลังงาน (2)
บทที่  1 ความรู้เกี่ยวกับพลังงาน (2)บทที่  1 ความรู้เกี่ยวกับพลังงาน (2)
บทที่ 1 ความรู้เกี่ยวกับพลังงาน (2)อัจฉรา นาคอ้าย
 
การเขียนรายงานการวิจัย
การเขียนรายงานการวิจัยการเขียนรายงานการวิจัย
การเขียนรายงานการวิจัยnoinasang
 
วิทยาการคำนวณ ม.5 - บทที่ 2 การเก็บรวบรวมและสำรวจข้อมูล
วิทยาการคำนวณ ม.5 - บทที่ 2 การเก็บรวบรวมและสำรวจข้อมูลวิทยาการคำนวณ ม.5 - บทที่ 2 การเก็บรวบรวมและสำรวจข้อมูล
วิทยาการคำนวณ ม.5 - บทที่ 2 การเก็บรวบรวมและสำรวจข้อมูลCoco Tan
 
ระบบจัดการร้านเบเกอรี่
ระบบจัดการร้านเบเกอรี่ระบบจัดการร้านเบเกอรี่
ระบบจัดการร้านเบเกอรี่Visiene Lssbh
 
Astronomy 03
Astronomy 03Astronomy 03
Astronomy 03Chay Kung
 

Tendances (20)

คู่มือ practical data mining with rapid miner studio7
คู่มือ practical data mining with rapid miner studio7คู่มือ practical data mining with rapid miner studio7
คู่มือ practical data mining with rapid miner studio7
 
Search Twitter with RapidMiner Studio 6
Search Twitter with RapidMiner Studio 6Search Twitter with RapidMiner Studio 6
Search Twitter with RapidMiner Studio 6
 
Data manipulation with RapidMiner Studio 7
Data manipulation with RapidMiner Studio 7Data manipulation with RapidMiner Studio 7
Data manipulation with RapidMiner Studio 7
 
วิทยาการคำนวณ ม.5 - บทที่ 1 ข้อมูลมีคุณค่า
วิทยาการคำนวณ ม.5 - บทที่ 1 ข้อมูลมีคุณค่าวิทยาการคำนวณ ม.5 - บทที่ 1 ข้อมูลมีคุณค่า
วิทยาการคำนวณ ม.5 - บทที่ 1 ข้อมูลมีคุณค่า
 
Practical Data Mining: FP-Growth
Practical Data Mining: FP-GrowthPractical Data Mining: FP-Growth
Practical Data Mining: FP-Growth
 
น 13 พฤติกรรมสารสนเทศ.2
น 13 พฤติกรรมสารสนเทศ.2น 13 พฤติกรรมสารสนเทศ.2
น 13 พฤติกรรมสารสนเทศ.2
 
03 data preprocessing
03 data preprocessing03 data preprocessing
03 data preprocessing
 
04 association
04 association04 association
04 association
 
กฎหมายคุ้มครองข้อมูลส่วนบุคคลกับบริบทการคุ้มครองข้อมูลส่วนบุคคลในกฎหมายอื่น
กฎหมายคุ้มครองข้อมูลส่วนบุคคลกับบริบทการคุ้มครองข้อมูลส่วนบุคคลในกฎหมายอื่นกฎหมายคุ้มครองข้อมูลส่วนบุคคลกับบริบทการคุ้มครองข้อมูลส่วนบุคคลในกฎหมายอื่น
กฎหมายคุ้มครองข้อมูลส่วนบุคคลกับบริบทการคุ้มครองข้อมูลส่วนบุคคลในกฎหมายอื่น
 
แนวทางการบริหารจัดการบริการทันตกรรม Fee schedule dental 2563
แนวทางการบริหารจัดการบริการทันตกรรม Fee schedule dental 2563แนวทางการบริหารจัดการบริการทันตกรรม Fee schedule dental 2563
แนวทางการบริหารจัดการบริการทันตกรรม Fee schedule dental 2563
 
PDPA Basics (March 13, 2021)
PDPA Basics (March 13, 2021)PDPA Basics (March 13, 2021)
PDPA Basics (March 13, 2021)
 
06 classification 2 bayesian and instance based classification
06 classification 2 bayesian and instance based classification06 classification 2 bayesian and instance based classification
06 classification 2 bayesian and instance based classification
 
ความรู้เกี่ยวกับนโยบายและแผน
ความรู้เกี่ยวกับนโยบายและแผนความรู้เกี่ยวกับนโยบายและแผน
ความรู้เกี่ยวกับนโยบายและแผน
 
แนวข้อสอบ ตำแหน่งบุคลากร นักทรัพยากรบุคคล
แนวข้อสอบ ตำแหน่งบุคลากร นักทรัพยากรบุคคลแนวข้อสอบ ตำแหน่งบุคลากร นักทรัพยากรบุคคล
แนวข้อสอบ ตำแหน่งบุคลากร นักทรัพยากรบุคคล
 
คู่มือ ลดพุง ลดโรค ฉบับประชาชน
คู่มือ ลดพุง ลดโรค ฉบับประชาชนคู่มือ ลดพุง ลดโรค ฉบับประชาชน
คู่มือ ลดพุง ลดโรค ฉบับประชาชน
 
บทที่ 1 ความรู้เกี่ยวกับพลังงาน (2)
บทที่  1 ความรู้เกี่ยวกับพลังงาน (2)บทที่  1 ความรู้เกี่ยวกับพลังงาน (2)
บทที่ 1 ความรู้เกี่ยวกับพลังงาน (2)
 
การเขียนรายงานการวิจัย
การเขียนรายงานการวิจัยการเขียนรายงานการวิจัย
การเขียนรายงานการวิจัย
 
วิทยาการคำนวณ ม.5 - บทที่ 2 การเก็บรวบรวมและสำรวจข้อมูล
วิทยาการคำนวณ ม.5 - บทที่ 2 การเก็บรวบรวมและสำรวจข้อมูลวิทยาการคำนวณ ม.5 - บทที่ 2 การเก็บรวบรวมและสำรวจข้อมูล
วิทยาการคำนวณ ม.5 - บทที่ 2 การเก็บรวบรวมและสำรวจข้อมูล
 
ระบบจัดการร้านเบเกอรี่
ระบบจัดการร้านเบเกอรี่ระบบจัดการร้านเบเกอรี่
ระบบจัดการร้านเบเกอรี่
 
Astronomy 03
Astronomy 03Astronomy 03
Astronomy 03
 

En vedette

Chapter06 การบริหารจัดการข้อมูล
Chapter06 การบริหารจัดการข้อมูลChapter06 การบริหารจัดการข้อมูล
Chapter06 การบริหารจัดการข้อมูลAkkadate.Com
 
CRISP-DM - Agile Approach To Data Mining Projects
CRISP-DM - Agile Approach To Data Mining ProjectsCRISP-DM - Agile Approach To Data Mining Projects
CRISP-DM - Agile Approach To Data Mining ProjectsMichał Łopuszyński
 
CRISP-DM: a data science project methodology
CRISP-DM: a data science project methodologyCRISP-DM: a data science project methodology
CRISP-DM: a data science project methodologySergey Shelpuk
 
Opinion Mining Tutorial (Sentiment Analysis)
Opinion Mining Tutorial (Sentiment Analysis)Opinion Mining Tutorial (Sentiment Analysis)
Opinion Mining Tutorial (Sentiment Analysis)Kavita Ganesan
 

En vedette (15)

Building Decision Tree model with numerical attributes
Building Decision Tree model with numerical attributesBuilding Decision Tree model with numerical attributes
Building Decision Tree model with numerical attributes
 
Evaluation metrics: Precision, Recall, F-Measure, ROC
Evaluation metrics: Precision, Recall, F-Measure, ROCEvaluation metrics: Precision, Recall, F-Measure, ROC
Evaluation metrics: Precision, Recall, F-Measure, ROC
 
Introduction to Data Analytics with RapidMiner Studio 6 (ภาษาไทย)
Introduction to Data Analytics with RapidMiner Studio 6 (ภาษาไทย)Introduction to Data Analytics with RapidMiner Studio 6 (ภาษาไทย)
Introduction to Data Analytics with RapidMiner Studio 6 (ภาษาไทย)
 
05 classification 1 decision tree and rule based classification
05 classification 1 decision tree and rule based classification05 classification 1 decision tree and rule based classification
05 classification 1 decision tree and rule based classification
 
Chapter06 การบริหารจัดการข้อมูล
Chapter06 การบริหารจัดการข้อมูลChapter06 การบริหารจัดการข้อมูล
Chapter06 การบริหารจัดการข้อมูล
 
CRISP-DM - Agile Approach To Data Mining Projects
CRISP-DM - Agile Approach To Data Mining ProjectsCRISP-DM - Agile Approach To Data Mining Projects
CRISP-DM - Agile Approach To Data Mining Projects
 
CRISP-DM: a data science project methodology
CRISP-DM: a data science project methodologyCRISP-DM: a data science project methodology
CRISP-DM: a data science project methodology
 
Opinion Mining Tutorial (Sentiment Analysis)
Opinion Mining Tutorial (Sentiment Analysis)Opinion Mining Tutorial (Sentiment Analysis)
Opinion Mining Tutorial (Sentiment Analysis)
 
Predictive analytic-for-retail-business
Predictive analytic-for-retail-businessPredictive analytic-for-retail-business
Predictive analytic-for-retail-business
 
Apply (Big) Data Analytics & Predictive Analytics to Business Application
Apply (Big) Data Analytics & Predictive Analytics to Business ApplicationApply (Big) Data Analytics & Predictive Analytics to Business Application
Apply (Big) Data Analytics & Predictive Analytics to Business Application
 
Introduction to Predictive Analytics with case studies
Introduction to Predictive Analytics with case studiesIntroduction to Predictive Analytics with case studies
Introduction to Predictive Analytics with case studies
 
Install weka extension_rapidminer
Install weka extension_rapidminerInstall weka extension_rapidminer
Install weka extension_rapidminer
 
การติดตั้ง RapidMiner Studio 6.1
การติดตั้ง RapidMiner Studio 6.1การติดตั้ง RapidMiner Studio 6.1
การติดตั้ง RapidMiner Studio 6.1
 
Introduction to Feature (Attribute) Selection with RapidMiner Studio 6
Introduction to Feature (Attribute) Selection with RapidMiner Studio 6Introduction to Feature (Attribute) Selection with RapidMiner Studio 6
Introduction to Feature (Attribute) Selection with RapidMiner Studio 6
 
Introduction to Weka: Application approach
Introduction to Weka: Application approachIntroduction to Weka: Application approach
Introduction to Weka: Application approach
 

Similaire à Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate

Introduction to big data and analytic eakasit patcharawongsakda
Introduction to big data and analytic eakasit patcharawongsakdaIntroduction to big data and analytic eakasit patcharawongsakda
Introduction to big data and analytic eakasit patcharawongsakdaBAINIDA
 
Social Media Analytics Challenges and Case Studies
Social Media Analytics Challenges and Case StudiesSocial Media Analytics Challenges and Case Studies
Social Media Analytics Challenges and Case Studieseakasit_dpu
 
Ayutthaya gov project_internet_marketing_by_dr_arnut_10july2018_dr.arnut - share
Ayutthaya gov project_internet_marketing_by_dr_arnut_10july2018_dr.arnut - shareAyutthaya gov project_internet_marketing_by_dr_arnut_10july2018_dr.arnut - share
Ayutthaya gov project_internet_marketing_by_dr_arnut_10july2018_dr.arnut - shareAsst.Prof.Dr.Arnut Ruttanatirakul
 
การบริการลูกค้าสัมพันธ์ ในงานห้องสมุด
การบริการลูกค้าสัมพันธ์ ในงานห้องสมุดการบริการลูกค้าสัมพันธ์ ในงานห้องสมุด
การบริการลูกค้าสัมพันธ์ ในงานห้องสมุดMaykin Likitboonyalit
 
BigData และการนำมาใช้BigData และการนำมาใช้
BigData และการนำมาใช้BigData และการนำมาใช้BigData และการนำมาใช้BigData และการนำมาใช้
BigData และการนำมาใช้BigData และการนำมาใช้SUMETRATPRACHUM1
 
Career Track: Business Analytics and Intelligence@NIDA โดย อาจารย์ ดร. อานนท์...
Career Track: Business Analytics and Intelligence@NIDA โดย อาจารย์ ดร. อานนท์...Career Track: Business Analytics and Intelligence@NIDA โดย อาจารย์ ดร. อานนท์...
Career Track: Business Analytics and Intelligence@NIDA โดย อาจารย์ ดร. อานนท์...BAINIDA
 
Trends and Services in Modern Library
Trends and Services in Modern LibraryTrends and Services in Modern Library
Trends and Services in Modern LibraryMaykin Likitboonyalit
 
นิตยสาร IT Trends ของ IMC Institute ฉบับที่ 10
นิตยสาร IT Trends ของ  IMC Institute  ฉบับที่ 10นิตยสาร IT Trends ของ  IMC Institute  ฉบับที่ 10
นิตยสาร IT Trends ของ IMC Institute ฉบับที่ 10IMC Institute
 
หน่วยการเรียนรู้ที่ 17
หน่วยการเรียนรู้ที่ 17หน่วยการเรียนรู้ที่ 17
หน่วยการเรียนรู้ที่ 17sangkom
 
ทักษะทางสารนิเทศเทอม154
ทักษะทางสารนิเทศเทอม154ทักษะทางสารนิเทศเทอม154
ทักษะทางสารนิเทศเทอม154nawasai
 
Understand Your Information Workshop (Thai) - UX Thailand 2017
Understand Your Information Workshop (Thai) - UX Thailand 2017Understand Your Information Workshop (Thai) - UX Thailand 2017
Understand Your Information Workshop (Thai) - UX Thailand 2017Phijarana (Pij) Rattanathikun
 
Big Data as a Service
Big Data as a ServiceBig Data as a Service
Big Data as a ServiceIMC Institute
 
Data Science สำหรับผู้เริ่มต้น - WordCamp Bangkok 2017
Data Science สำหรับผู้เริ่มต้น - WordCamp Bangkok 2017Data Science สำหรับผู้เริ่มต้น - WordCamp Bangkok 2017
Data Science สำหรับผู้เริ่มต้น - WordCamp Bangkok 2017woratana
 
การพัฒนาและการให้บริการห้องสมุดในยุค Thailand 4.0
การพัฒนาและการให้บริการห้องสมุดในยุค Thailand 4.0การพัฒนาและการให้บริการห้องสมุดในยุค Thailand 4.0
การพัฒนาและการให้บริการห้องสมุดในยุค Thailand 4.0Maykin Likitboonyalit
 
บทความ Big Data จากบล็อก thanachart.org
บทความ Big Data จากบล็อก thanachart.orgบทความ Big Data จากบล็อก thanachart.org
บทความ Big Data จากบล็อก thanachart.orgIMC Institute
 

Similaire à Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate (20)

Practical Data Science 
Use-cases in Retail & eCommerce
Practical Data Science 
Use-cases in Retail & eCommercePractical Data Science 
Use-cases in Retail & eCommerce
Practical Data Science 
Use-cases in Retail & eCommerce
 
Introduction to big data and analytic eakasit patcharawongsakda
Introduction to big data and analytic eakasit patcharawongsakdaIntroduction to big data and analytic eakasit patcharawongsakda
Introduction to big data and analytic eakasit patcharawongsakda
 
First Step to Big Data
First Step to Big DataFirst Step to Big Data
First Step to Big Data
 
Social Media Analytics Challenges and Case Studies
Social Media Analytics Challenges and Case StudiesSocial Media Analytics Challenges and Case Studies
Social Media Analytics Challenges and Case Studies
 
Ayutthaya gov project_internet_marketing_by_dr_arnut_10july2018_dr.arnut - share
Ayutthaya gov project_internet_marketing_by_dr_arnut_10july2018_dr.arnut - shareAyutthaya gov project_internet_marketing_by_dr_arnut_10july2018_dr.arnut - share
Ayutthaya gov project_internet_marketing_by_dr_arnut_10july2018_dr.arnut - share
 
การบริการลูกค้าสัมพันธ์ ในงานห้องสมุด
การบริการลูกค้าสัมพันธ์ ในงานห้องสมุดการบริการลูกค้าสัมพันธ์ ในงานห้องสมุด
การบริการลูกค้าสัมพันธ์ ในงานห้องสมุด
 
BigData และการนำมาใช้BigData และการนำมาใช้
BigData และการนำมาใช้BigData และการนำมาใช้BigData และการนำมาใช้BigData และการนำมาใช้
BigData และการนำมาใช้BigData และการนำมาใช้
 
Career Track: Business Analytics and Intelligence@NIDA โดย อาจารย์ ดร. อานนท์...
Career Track: Business Analytics and Intelligence@NIDA โดย อาจารย์ ดร. อานนท์...Career Track: Business Analytics and Intelligence@NIDA โดย อาจารย์ ดร. อานนท์...
Career Track: Business Analytics and Intelligence@NIDA โดย อาจารย์ ดร. อานนท์...
 
Trends and Services in Modern Library
Trends and Services in Modern LibraryTrends and Services in Modern Library
Trends and Services in Modern Library
 
นิตยสาร IT Trends ของ IMC Institute ฉบับที่ 10
นิตยสาร IT Trends ของ  IMC Institute  ฉบับที่ 10นิตยสาร IT Trends ของ  IMC Institute  ฉบับที่ 10
นิตยสาร IT Trends ของ IMC Institute ฉบับที่ 10
 
หน่วยการเรียนรู้ที่ 17
หน่วยการเรียนรู้ที่ 17หน่วยการเรียนรู้ที่ 17
หน่วยการเรียนรู้ที่ 17
 
20180814 next stepaa-aaannualmeeting2561-1
20180814 next stepaa-aaannualmeeting2561-120180814 next stepaa-aaannualmeeting2561-1
20180814 next stepaa-aaannualmeeting2561-1
 
ทักษะทางสารนิเทศเทอม154
ทักษะทางสารนิเทศเทอม154ทักษะทางสารนิเทศเทอม154
ทักษะทางสารนิเทศเทอม154
 
Understand Your Information Workshop (Thai) - UX Thailand 2017
Understand Your Information Workshop (Thai) - UX Thailand 2017Understand Your Information Workshop (Thai) - UX Thailand 2017
Understand Your Information Workshop (Thai) - UX Thailand 2017
 
Big Data as a Service
Big Data as a ServiceBig Data as a Service
Big Data as a Service
 
Big data 101
Big data 101Big data 101
Big data 101
 
Computer project
Computer projectComputer project
Computer project
 
Data Science สำหรับผู้เริ่มต้น - WordCamp Bangkok 2017
Data Science สำหรับผู้เริ่มต้น - WordCamp Bangkok 2017Data Science สำหรับผู้เริ่มต้น - WordCamp Bangkok 2017
Data Science สำหรับผู้เริ่มต้น - WordCamp Bangkok 2017
 
การพัฒนาและการให้บริการห้องสมุดในยุค Thailand 4.0
การพัฒนาและการให้บริการห้องสมุดในยุค Thailand 4.0การพัฒนาและการให้บริการห้องสมุดในยุค Thailand 4.0
การพัฒนาและการให้บริการห้องสมุดในยุค Thailand 4.0
 
บทความ Big Data จากบล็อก thanachart.org
บทความ Big Data จากบล็อก thanachart.orgบทความ Big Data จากบล็อก thanachart.org
บทความ Big Data จากบล็อก thanachart.org
 

Practical Data Mining with RapidMiner Studio 7 : A Basic and Intermediate

  • 1. Practical Data Mining 
 with RapidMiner Studio 7 : A Basic & Intermediate Eakasit Pacharawongsakda, Ph.D. 13-15 March 2017
 at K.U. Home Hotel, Kasetsart University The 17th course of
  • 3. http://dataminingtrend.com http://facebook.com/datacube.th About us • ชื่อ: เอกสิทธิ์ พัชรวงศ์ศักดา • การศึกษา: • ปริญญาเอก วิทยาการคอมพิวเตอร์ 
 สถาบันเทคโนโลยีนานาชาติสิรินธร (SIIT) มหาวิทยาลัยธรรมศาสตร์ • ปริญญาโท วิศวกรรมคอมพิวเตอร์ มหาวิทยาลัยเกษตรศาสตร์ • ปริญญาตรี วิศวกรรมคอมพิวเตอร์ มหาวิทยาลัยเกษตรศาสตร์ 
 (เกียรตินิยมอันดับ 2) • ประสบการณ์ • Certified RapidMiner Analyst and Ambassador • Research Collaboration with Western Digital (Thailand) เฟสที่ 1 ระยะเวลา 6 เดือน • ร่วมวิจัย โครงการสํารวจข้อมูลเพื่อการวิเคราะห์พฤติกรรมของนักท่องเที่ยวเชิงลึก ด้วยวิธีการทําเหมือง ข้อมูล การท่องเที่ยวแห่งประเทศไทย (ททท) • วิทยากรอบรมการใช้งานซอฟต์แวร์ open source ทางด้าน data mining 3
  • 4. http://dataminingtrend.com http://facebook.com/datacube.th About us • หนังสือ Data Mining ฉบับภาษาไทย 4
  • 5. http://dataminingtrend.com http://facebook.com/datacube.th About us 5 RapidMiner Analyst Certification This is to Certify that Successfully passed the examination for the Certified RapidMiner Analyst. The RapidMiner Analyst certification level is designed for individuals who wish to demonstrate a fundamental understanding of how RapidMiner software works and is used. Certified Analyst professionals will be able to prepare data and create predictive models in standard data environments typically found within most analyst positions. The candidate has proven the ability to:  Prepare data  Build predictive models  Evaluate the model’s quality  Score new data sets  Deploy data mining models With:  RapidMiner Studio  RapidMiner Server Date: Eakasit Pacharawongsakda
  • 9. Introduction to Data Mining Chapter 1
  • 10. http://dataminingtrend.com http://facebook.com/datacube.th Where does data come from? • ข้อมูลแบ่งตามที่มา • ภายในบริษัท/องค์กร • ข้อมูลการซื้อขาย • ข้อมูลประวัติลูกค้า • ข้อมูลประวัติพนักงาน • ภายนอกบริษัท/องค์กร • ข้อมูลจาก social media ต่างๆ • ข้อมูลข่าวต่างๆ • ข้อมูลรูปภาพและเสียง 10 source: http://dailyprivacy.files.wordpress.com/2013/02/2012_big_data_study_infographic_600.jpg
  • 11. http://dataminingtrend.com http://facebook.com/datacube.th Database & warehouse & mining 11 Database Sales Accounting CRM Extract
 Transform
 Load
 (ETL) Data Mining Data Warehouse image source:https://sites.google.com/a/whps.org/diamond-teamkp/
 http://www.iconarchive.com/tag/data
  • 12. http://dataminingtrend.com http://facebook.com/datacube.th facebook.com/datacube.th BI & Data Mining 12 Business Intelligence Data Mining Time Analytical 
 Approach Past Future Explanatory Exploratory source:Data Science and Big Data Analytics: Discovering, analyzing, visualizing and presenting data BI questions • What happened last quarter? • How many unit sold? • Where is the problem? In which situations Data Mining questions • What if … ? • What will happen next? • Why is this happen?
  • 13. http://dataminingtrend.com http://facebook.com/datacube.th What is data mining 13 ข้อมูล' เทคนิคการทำ data mining' รูปแบบที่มีประโยชน์' image source:http://www.computerrepairanaheim.net
 https://sites.google.com/a/whps.org/diamond-teamkp/
 http://meetings2.informs.org/wordpress/analytics2014/2014/04/01/why-oranalytics-people-need-to-know-about-database-technology/ facebook.com/datacube.th
  • 14. http://dataminingtrend.com http://facebook.com/datacube.th Data mining application • บัตรสมาชิก (loyalty card) • ติดตามพฤติกรรมการซื้อสินค้า ของลูกค้าจากบัตร loyalty • นำมาวิเคราะห์และนำเสนอเป็น โปรโมชันพิเศษให้แต่ละบุคคล • เพิ่มโอกาสในการขายสินค้าให้กับ ลูกค้า • กระตุ้นให้ลูกค้าได้ซื้อสินค้ามาก ขึ้น เช่น ซื้อสินค้าวันนี้ จะได้ ส่วนลดพิเศษ ทำให้ลูกค้าเกิดการ ตัดสินใจซื้อทันที 14 image source: http://www.positioningmag.com
  • 15. http://dataminingtrend.com http://facebook.com/datacube.th Data mining application • ทราบพฤติกรรมการซื้อสินค้าของลูกค้า เพื่อนำมาวิเคราะห์ และ
 นำเสนอเป็นโปรโมชันพิเศษให้แต่ละบุคคล 15 image source: http://www.dream-base.com/tesco/clubcard.php?p=spend&lang=en
  • 16. http://dataminingtrend.com http://facebook.com/datacube.th Data mining application • เบียร์และผ้าอ้อม • ห้าง Walmart พบว่าทุกวันศุกร์ หลังบ่ายโมง จะมีลูกค้าเพศชาย อายุระหว่าง 25 – 35 ปี ซื้อสินค้า Beers และ Diapers มากที่สุด 16 image source:http://blog.beau-coup.com/guy-friendly-baby-showers-beer-and-diapers-theme https://www.linkedin.com/pulse/20140403185417-4785379-diapers-and-beer
  • 17. http://dataminingtrend.com http://facebook.com/datacube.th Data mining application • คาดการณ์การตั้งครรภ์ • ห้าง Target ทำการวิเคราะห์ พฤติกรรมการซื้อสินค้าของ ลูกค้าเพศหญิง • พบรูปแบบ (pattern) ว่า ถ้ามี การซื้อวิตามิน ซื้ออาหารบำรุง หรือ ซื้อตู้เตียงเพิ่ม ลูกค้าจะ เริ่มตั้งครรภ์ • Target จะส่ง promotion ให้ ลูกค้าเหล่านั้น 17 source: http://www.youtube.com/watch?v=f2Kji24833Y
  • 18. http://dataminingtrend.com http://facebook.com/datacube.th Data mining application • แนะนำสินค้าที่เกี่ยวข้อง • amazon.com แนะนำหนังสือที่เกี่ยวข้องกับ RapidMiner • Netflix แนะนำภาพยนต์ที่คล้ายกับที่เคยดู เช่น Life of Pi 18 source: http://www.amazon.com และ http://www.netflix.com
  • 19. http://dataminingtrend.com http://facebook.com/datacube.th Data mining application • ทำนายอายุและเพศจากรูปภาพ 19 source: http://www.how-old.net
  • 20. http://dataminingtrend.com http://facebook.com/datacube.th Data mining application • Google News แนะนำข่าวที่เกี่ยวข้อง 20 source:https://news.google.com
  • 21. http://dataminingtrend.com http://facebook.com/datacube.th Data mining application • วิเคราะห์ทัศนคติในแง่ต่างๆ จากสังคมออนไลน์ 21source:http://sentiment140.com และ http://www.techguide.com.au
  • 22. http://dataminingtrend.com http://facebook.com/datacube.th Data mining application • วิเคราะห์ทัศนคติในแง่ต่างๆ จากสังคมออนไลน์ (ภาษาไทย) 22 source:http://pop.ssense.in.th
  • 24. http://dataminingtrend.com http://facebook.com/datacube.th CRISP-DM • CRoss-Industry Standard Process for Data Mining (CRISP-DM) • พัฒนาขึ้นโดย 3 บริษัท • บริษัท SPSS • บริษัท DaimlerChrysler • บริษัท NCR • เป็น Workflow มาตรฐานสำหรับการทำ data mining • ประกอบด้วย 6 ขั้นตอน 24
  • 25. http://dataminingtrend.com http://facebook.com/datacube.th CRISP-DM 25 3 ขั้นตอนแรกจะใช้เวลา 80% ของทั้งหมด 1 2 3 4 5 6 image source: Foster Provost, Data Science for Business: What you need to know about data mining and data-analytic thinking, August 19, 2013 facebook.com/datacube.th
  • 26. http://dataminingtrend.com http://facebook.com/datacube.th 1. Business Understanding • ขั้นตอนแรกของ CRISP-DM • ทำความเข้าใจกับปัญหา หรือ โอกาสเชิงธุรกิจ • ระบุ output หรือเป้าหมายที่ต้องการได้จากการวิเคราะห์ข้อมูลด้วย data mining • ตัวอย่างเช่น • ทำอย่างไรถึงเพิ่มยอดขายให้กับสินค้าชนิดต่างๆ ได้ • ต้องการแบ่งกลุ่มนักศึกษาออกตามความสนใจ • ทำอย่างไรให้ลูกค้ากลับมาซื้อสินค้าได้อีก • อยากทำนายปริมาณน้ำฝนที่ตกใน 2 วันถัดไป • อยากรู้ว่าลูกค้าคนใดบ้างมีโอกาสป่วยเป็นโรคมะเร็ง 26 Business Understanding Data Understanding Data Preparation Modeling Evaluation Deployment
  • 27. http://dataminingtrend.com http://facebook.com/datacube.th • ในขั้นตอนนี้เป็นการ • รวบรวมข้อมูลที่เกี่ยวข้อง • ข้อมูลถูกต้องน่าเชื่อถือ • ข้อมูลที่ได้มีปริมาณมากพอหรือยัง • ข้อมูลที่ได้มีความเหมาะสม มีรายละเอียดเพียงพอต่อการนำไปใช้ในการวิเคราะห์ • ตัวอย่าง • ข้อมูลการซื้อสินค้าคนแต่ละบุคคล • ข้อมูลการลงทะเบียนและผลการศึกษาของนักศึกษา Business Understanding Data Understanding Data Preparation Modeling Evaluation Deployment 2. Data Understanding 27
  • 28. http://dataminingtrend.com http://facebook.com/datacube.th • ขั้นตอนการเตรียมข้อมูลเป็นขั้นตอนที่ใช้เวลานานที่สุด • เนื่องจากโมเดลที่ได้จากการทำดาต้าไมน์นิ่งจะให้ผลลัพทธ์ที่ถูกต้อง หรือไม่นั้น ขึ้นอยู่กับคุณภาพของข้อมูลที่ใช้ แบ่งออกได้เป็น 3 ขั้นตอน ย่อยคือ • 3.1 ทำการคัดเลือกข้อมูล (Data Selection)  • กำหนดเป้าหมายก่อนว่าเราจะทำการวิเคราะห์อะไร • เลือกใช้เฉพาะข้อมูลที่เกี่ยวข้องกับสิ่งที่เราจะทำการวิเคราะห์ Business Understanding Data Understanding Data Preparation Modeling Evaluation Deployment 3. Data Preparation 28
  • 29. http://dataminingtrend.com http://facebook.com/datacube.th • 3.2 ทำการกลั่นกรองข้อมูล (Data Cleaning)  • ลบข้อมูลซ้ำซ้อน • แก้ไขข้อมูลที่ผิดพลาด • ข้อมูลผิดรูปแบบ • ข้อมูลที่หายไป • ข้อมูล outlier ที่แปลกแยกจากคนอื่น Business Understanding Data Understanding Data Preparation Modeling Evaluation Deployment 3. Data Preparation 29 รหัส เพศ อายุ ความสูง น้ำหนัก 57001 ชาย 18 180 70 5702A ญ 80 35 57123 หญิง 19 150 2500 58002 ช 17 175 90 ข้อมูลนักศึกษาชั้นปีที่ 1 ปีการศึกษา 2557 ผิดรูปแบบ ขาดหาย outlier
  • 30. http://dataminingtrend.com http://facebook.com/datacube.th • 3.3 แปลงรูปแบบของข้อมูล (data transformation) • เป็นขั้นตอนการเตรียมข้อมูลให้อยู่ในรูปแบบที่พร้อมนำไปใช้ในการวิเคราะห์
 ตามอัลกอริทึมของ data mining ที่เลือกใช้ Business Understanding Data Understanding Data Preparation Modeling Evaluation Deployment 3. Data Preparation 30 ID สินค้า จำนวนที่ซื้อ 1 ปากกา 1 1 ยางลบ 1 1 คลิป 10 2 สมุด 2 2 ปากกา 2 3 สมุด 1 3 ปากกา 3 3 ยางลบ 2 ID สมุด ปากกา ยางลบ คลิป 1 - TRUE TRUE TRUE 2 TRUE TRUE - - 3 TRUE TRUE TRUE - ข้อมูลในฐานข้อมูล POS ข้อมูลสำหรับการหากฏความสัมพันธ์ (Association Rules)
  • 31. http://dataminingtrend.com http://facebook.com/datacube.th • 3.3 แปลงรูปแบบของข้อมูล (data transformation) • เป็นขั้นตอนการเตรียมข้อมูลให้อยู่ในรูปแบบที่พร้อมนำไปใช้ในการวิเคราะห์
 ตามอัลกอริทึมของ data mining ที่เลือกใช้ Business Understanding Data Understanding Data Preparation Modeling Evaluation Deployment 3. Data Preparation 31 เมื่อวันที่ 4 มกราคม 2557 เฟซบุ๊กเปิดตัวหน้าเพจใหม่ชื่อว่า Facebook A Look Back เมื่อผู้ใช้งาน คลิกไปยังหน้านี้ก็จะแสดงคลิปวิดีโอที่บอกเล่าเรื่องราวของผู้ใช้งานคนนั้นๆ เช่น เริ่มเล่นเฟซบุ๊กครั้ง แรกปีไหน, โพสต์แรกบนเฟซบุ๊ก, รูปภาพที่ถูกกดไลค์มากที่สุด, รูปภาพที่ถูกแชร์มากที่สุด และ 20 อันดับเรื่องราวต่าง ๆ ที่เกิดขึ้นในเฟซบุ๊กก็จะถูกแสดงและรวบรวมไว้ในคลิปวิดีโอนี้ ID เฟซบุ๊ก รูปภาพ ไลค์ แชร์ คลิปวิดีโอ 1 4 2 1 1 2 2 … เอกสารข่าว ตารางแสดงจำนวนความถี่ของแต่ละคำ
  • 32. http://dataminingtrend.com http://facebook.com/datacube.th • 3.3 แปลงรูปแบบของข้อมูล (data transformation) • เป็นขั้นตอนการเตรียมข้อมูลให้อยู่ในรูปแบบที่พร้อมนำไปใช้ในการวิเคราะห์
 ตามอัลกอริทึมของ data mining ที่เลือกใช้ Business Understanding Data Understanding Data Preparation Modeling Evaluation Deployment 3. Data Preparation 32 ID สีแดง สีเขียว สีน้ำเงิน 1 93 98 167 2 … รูปภาพ จำนวน pixel สีแดง สีเขียว สีนำ้เงินที่ปรากฏในรูปภาพ image source:http://www.travelhouse.ch/reisen/thailand/phuket/jw-marriott-phuket-resort-and-spa
  • 33. http://dataminingtrend.com http://facebook.com/datacube.th CRISP-DM 33 3 ขั้นตอนหลังจะใช้เวลา 20% ของทั้งหมด 1 2 3 4 5 6 image source: Foster Provost, Data Science for Business: What you need to know about data mining and data-analytic thinking, August 19, 2013
  • 34. http://dataminingtrend.com http://facebook.com/datacube.th • เป็นขั้นตอนการวิเคราะห์ข้อมูลด้วยเทคนิคดาต้าไมน์นิ่ง • classification • สร้างโมเดลจากข้อมูลที่มีอยู่เพื่อทำนายอนาคต • เช่น ทำนายปริมาณน้ำฝนที่ตกในวันถัดไป • clustering • แบ่งข้อมูลหลายๆ กลุ่มตามความคล้ายคลึง • เช่น แบ่งกลุ่มนักศึกษาตามคะแนนที่ได้ • association rules • หาความสัมพันธ์ของข้อมูลที่เกิดร่วมกัน • เช่น ค้นหาสินค้าที่มีการซื้อร่วมกันบ่อยๆ Business Understanding Data Understanding Data Preparation Modeling Evaluation Deployment 4. Modeling 34 classification clustering association rules
  • 36. http://dataminingtrend.com http://facebook.com/datacube.th Business Understanding Data Understanding Data Preparation Modeling Evaluation Deployment 6. Deployment • นำโมเดลที่ได้ หรือ ผลการวิเคราะห์ที่ได้ไปใช้งานจริง 36 ใช้จากกฏความสัมพันธ์ที่หาได้ image source: http://www.mysupermarket.co.uk/brands/tesco_discounter_brand_in_tesco.html
  • 37. http://dataminingtrend.com http://facebook.com/datacube.th CRISP-DM Example 1 • ตัวอย่าง CRISP-DM • อ้างอิงจากงานวิจัยเรื่อง การใช้เทคนิคดาต้าไมน์นิงเพื่อพัฒนาคุณภาพการ ศึกษานิสิตคณะวิศวกรรมศาสตร์ * 1. Business Understanding • นิสิตคณะวิศวกรรมศาสตร์ ม.เกษตรศาสตร์ จะเลือกภาควิชาเมื่อในชั้นปีที่ 2 • นิสิตเลือกภาควิชาไม่ตรงกับความสามารถของตนเอง • เลือกตามเพื่อน • เลือกตามที่ผู้ปกครองแนะนำ • นิสิตบางคนได้ผลการเรียนตกต่ำและทำให้ต้องออกจากมหาวิทยาลัยกลางคัน 37 * กฤษณะ ไวยมัย , ชิดชนก ส่งศิริ และ ธนาวินท์ รักธรรมานนท์, การใช้เทคนิคดาต้าไมน์นิงเพื่อพัฒนาคุณภาพการศึกษานิสิตคณะ
 วิศวกรรมศาสตร์, NECTEC Technical Journal, 3(11), 2001
  • 38. http://dataminingtrend.com http://facebook.com/datacube.th CRISP-DM Example 1 2. Data Understanding • ข้อมูลนิสิตคณะวิศวกรรมศาสตร์ ม.เกษตรศาสตร์ช่วงปี พ.ศ. 2535 - 2542 • นิสิตประมาณ 10,000 คน • ข้อมูลมีจำนวน 476,085 แถว • ข้อมูลแบ่งเป็น 2 ส่วน • ข้อมูลประวัติส่วนตัวของนิสิต • เพศ, ที่อยู่, GPA ระดับมัธยมปลาย, GPA ชั้นปีที่ 1 • ข้อมูลการลงทะเบียนของนิสิต • เกรดวิชาคณิตศาสตร์, เกรดวิชาฟิสิกส์, เกรดวิชาเคมี 38
  • 39. http://dataminingtrend.com http://facebook.com/datacube.th CRISP-DM Example 1 3. Data Preparation • คัดเลือกวิชาที่เกี่ยวข้องกับภาควิชาต่างๆ ในคณะวิศวกรรมศาสตร์ • แปลงข้อมูลให้เหมาะสมกับการวิเคราะห์ 39 รหัสนิสิต เพศ ที่อยู่ GPA มัธยมปลาย … GPA 37058063 ชาย กรุงเทพ 2.5 … 2.3 37058167 ชาย สงขลา 3.4 … 3.3 … … … … … … ข้อมูลประวัติส่วนตัวของนิสิต รหัสนิสิต วิชา ปีการศึกษา เกรด 37058063 คอมพิวเตอร์ 2537 C+ 37058063 คณิตศาสตร์ 2537 D … … … … ข้อมูลการลงทะเบียนของนิสิต รหัสนิสิต เพศ คอมพิวเตอร์ คณิตศาสตร์ … GPA 37058063 ชาย LOW LOW … 2.3 37058167 ชาย HIGH HIGH … 3.3 … … … … … … ข้อมูลสำหรับการใช้วิเคราะห์
  • 40. http://dataminingtrend.com http://facebook.com/datacube.th CRISP-DM Example 1 4. Modeling • แบ่งข้อมูลออกเป็น 2 ส่วน คือ • 70% ของข้อมูลทั้งหมดใช้ในการสร้างโมเดล • 30% ของข้อมูลทั้งหมดใช้ในการทดสอบประสิทธิภาพของโมเดล • สร้างโมเดลด้วยเทคนิค Decision Tree ซึ่งจะได้โมเดลที่สามารถเข้าใจได้ง่าย • โมเดลแบ่งแยกตามภาควิชาต่างๆ เช่น ภาควิชาวิศวกรรมคอมพิวเตอร์ วิศกรรมไฟฟ้า • คำตอบ (class) จะแบ่งเป็น 2 ประเภท คือ • GOOD หมายถึง นิสิตเรียนในภาควิชานี้แล้วจบมาได้ GPA อยู่ในช่วง 40% แรก (top 40%) • BAD หมายถึง นิสิตเรียนในภาควิชานี้แล้วจบมาได้ GPA อยู่ในช่วง 40% จากท้าย (bottom 40%) 40
  • 41. http://dataminingtrend.com http://facebook.com/datacube.th CRISP-DM Example 1 4. Modeling 41 Computer = HIGH = LOW Physics Good Good = LOW = HIGH Mathematics Good Bad = HIGH = LOW • IF Computer is HIGH THEN Graduate is Good • IF Computer is LOW AND
 Mathematics is HIGH THEN
 Graduate is Good • IF Computer is LOW AND
 Mathematics is LOW AND
 Physics is HIGH THEN
 Graduate is Good • IF Computer is LOW AND
 Mathematics is LOW AND
 Physics is LOW THEN
 Graduate is Bad โมเดลของภาควิชาวิศวกรรมคอมพิวเตอร์ เงื่อนไขที่สร้างได้จากโมเดล
  • 42. http://dataminingtrend.com http://facebook.com/datacube.th CRISP-DM Example 1 5. Evaluation • ทดสอบด้วยข้อมูล 30% ที่แบ่งไว้ • คำนวณค่าความถูกต้อง 6. Deployment • นำไปแนะนำนิสิตชั้นปีที่ 1 ที่กำลัง
 จะเลือกภาควิชา • พิจารณาจากเกรดตามโมเดล
 ที่สร้างได้ 42 Computer = HIGH = LOW Physics Good Good = LOW = HIGH Mathematics Good Bad = HIGH = LOW โมเดลของภาควิชาวิศวกรรมคอมพิวเตอร์ รหัสนิสิต เพศ คอมพิวเตอร์ คณิตศาสตร์ … Com Eng 5700123 ชาย LOW HIGH … ?? ข้อมูลของนักศึกษาปีที่ 1 ที่ต้องการได้รับคำแนะนำ
  • 43. http://dataminingtrend.com http://facebook.com/datacube.th CRISP-DM Example 1 5. Evaluation • ทดสอบด้วยข้อมูล 30% ที่แบ่งไว้ • คำนวณค่าความถูกต้อง 6. Deployment • นำไปแนะนำนิสิตชั้นปีที่ 1 ที่กำลัง
 จะเลือกภาควิชา • พิจารณาจากเกรดตามโมเดล
 ที่สร้างได้ 43 Computer = HIGH = LOW Physics Good Good = LOW = HIGH Mathematics Good Bad = HIGH = LOW โมเดลของภาควิชาวิศวกรรมคอมพิวเตอร์ รหัสนิสิต เพศ คอมพิวเตอร์ คณิตศาสตร์ … Com Eng 5700123 ชาย LOW HIGH … ?? ข้อมูลของนักศึกษาปีที่ 1 ที่ต้องการได้รับคำแนะนำ
  • 44. http://dataminingtrend.com http://facebook.com/datacube.th CRISP-DM Example 1 5. Evaluation • ทดสอบด้วยข้อมูล 30% ที่แบ่งไว้ • คำนวณค่าความถูกต้อง 6. Deployment • นำไปแนะนำนิสิตชั้นปีที่ 1 ที่กำลัง
 จะเลือกภาควิชา • พิจารณาจากเกรดตามโมเดล
 ที่สร้างได้ 44 Computer = HIGH = LOW Physics Good Good = LOW = HIGH Mathematics Good Bad = HIGH = LOW โมเดลของภาควิชาวิศวกรรมคอมพิวเตอร์ รหัสนิสิต เพศ คอมพิวเตอร์ คณิตศาสตร์ … Com Eng 5700123 ชาย LOW HIGH … ?? ข้อมูลของนักศึกษาปีที่ 1 ที่ต้องการได้รับคำแนะนำ
  • 45. http://dataminingtrend.com http://facebook.com/datacube.th CRISP-DM Example 1 5. Evaluation • ทดสอบด้วยข้อมูล 30% ที่แบ่งไว้ • คำนวณค่าความถูกต้อง 6. Deployment • นำไปแนะนำนิสิตชั้นปีที่ 1 ที่กำลัง
 จะเลือกภาควิชา • พิจารณาจากเกรดตามโมเดล
 ที่สร้างได้ 45 Computer = HIGH = LOW Physics Good Good = LOW = HIGH Mathematics Good Bad = HIGH = LOW โมเดลของภาควิชาวิศวกรรมคอมพิวเตอร์ รหัสนิสิต เพศ คอมพิวเตอร์ คณิตศาสตร์ … Com Eng 5700123 ชาย LOW HIGH … Good ข้อมูลของนักศึกษาปีที่ 1 ที่ต้องการได้รับคำแนะนำ
  • 46. Introduction to 
 RapidMiner Studio 7 Chapter 3
  • 47. http://dataminingtrend.com http://facebook.com/datacube.th Data mining software • Commercial software • SAS Enterprise Miner • IBM SPSS Modeller • RapidMiner Studio 47 • Open source software • RapidMiner Studio • Weka • R
  • 51. http://dataminingtrend.com http://facebook.com/datacube.th Introduction RapidMiner • RapidMiner • ในตอนแรกใช้ชื่อบริษัทว่า Rapid-I ก่อตั้งขึ้นเมื่อปี 2006 • ในช่วงแรกบริษัทตั้งอยู่ที่ประเทศเยอรมนี • ปี 2013 ได้เปลี่ยนชื่อบริษัทเป็น RapidMiner หลังจาก
 ได้รับเงินลงทุนจำนวน 5 ล้านเหรียญสหรัฐ • และย้ายบริษัทมาอยู่ที่บอสตัน ประเทศสหรัฐอเมริกา • ผลิตภัณฑ์หลักของบริษัทคือ RapidMiner Studio 7 • บริษัทชั้นนำต่างๆ เช่น PayPal ใช้ซอฟต์แวร์ RapidMiner Studio 7 51 Ingo Mierswa Ralf Klinkenberg source: http://techcrunch.com/2013/11/04/german-predictive-analytics-startup-rapid-i-rebrands-as-rapidminer-takes-5m-from-open-ocean-
 earlybird-to-tackle-the-u-s-market/
  • 52. http://dataminingtrend.com http://facebook.com/datacube.th Why RapidMiner? • ผลการสำรวจจากเว็บไซต์ KDnuggets ในปี 2014 พบว่าผู้ร่วมตอบ แบบสำรวจใช้ RapidMiner ในการวิเคราะห์ข้อมูลมากเป็นอันดับ 1 • Gartner ได้จัดให้ RapidMiner อยู่
 ในกลุ่ม Leaders สำหรับซอฟต์แวร์
 ในการวิเคราะห์ข้อมูล (2016) • SAS • IBM • KNIME • RapidMiner 52 source: http://www.kdnuggets.com/2014/06/kdnuggets-annual-software-poll-rapidminer-continues-lead.html
 https://www.gartner.com/doc/reprints?id=1-2YEVU8U&ct=160210&st=sb
  • 53. http://dataminingtrend.com http://facebook.com/datacube.th RapidMiner Studio 7 • download ได้จาก http://rapidminer.com 53 คลิกที่เมนูนี้
  • 54. http://dataminingtrend.com http://facebook.com/datacube.th RapidMiner Studio 7 • เลือกดาวน์โหลด version ที่เหมาะสมกับระบบปฏิบัติการของเรา 54
  • 56. http://dataminingtrend.com http://facebook.com/datacube.th • พบกับหน้าต่าง Home Screen RapidMiner Studio 7 56 1 แนะนำการใข้งานเบื้องต้น 4 3 เปิด process ที่มีอยู่ สร้าง process ใหม่ 2 ดูตัวอย่างที่เตรียมไว้
  • 57. http://dataminingtrend.com http://facebook.com/datacube.th RapidMiner Studio 7 • องค์ประกอบของ RapidMiner Studio 7 57 Repository Operators Process Parameter help 1 2 3 4 5
  • 58. http://dataminingtrend.com http://facebook.com/datacube.th RapidMiner Studio 7 • เมนูใน RapidMiner Studio 7 58 ใช้สร้าง process ใหม่ โหลด process เดิม บันทึก process undo หรือ redo สั่งให้ process ทำงาน (run) ยกเลิก process (stop) เมนูสำหรับปรับเปลี่ยนมุมมองของ RapidMiner Studio 7 เมนูสำหรับแสดงวิธีการใช้งานในรูปแบบต่างๆ ba a b หน้า Design แสดงหน้าสำหรับการสร้างโพรเซส หน้า Results แสดงหน้าผลลัพธ์การทำงาน
  • 60. http://dataminingtrend.com http://facebook.com/datacube.th Data • ข้อมูลแสดงในรูปแบบของตาราง • แถว เรียกว่า ตัวอย่าง (example) • คอลัมน์ เรียกว่า แอตทริบิวต์ (attribute) ซึ่มีหน้าที่ (role) ที่ใช้งานบ่อย 3 แบบ • ไอดี (ID) เป็นแอตทริบิวต์ที่แสดงหมายเลขของข้อมูล หรือ primary key ในฐานข้อมูล • แอตทริบิวต์ทั่วไป (attribute) เป็นแอตทริบิวต์ปกติที่จะใช้ในการสร้างโมเดลหรือเรียกว่า เป็น ฟีเจอร์ (feature) หรือตัวแปรต้น (independent variable) • ลาเบล (label) เป็นแอตทริบิวต์ขนิดพิเศษที่มักจะใช้แสดงคำตอบของสิ่งที่เราต้องการจะ สร้างโมเดลมาทำนาย หรือ เรียกว่า คลาส (class) หรือตัวแปรตาม (dependent variable) 60 customer_id age gender region income married children car response ID12101 48 FEMALE INNER_CITY 17546.0 NO 1 NO NO ID12102 40 MALE TOWN 30085.1 YES 3 YES NO ID12103 51 FEMALE INNER_CITY 16575.4 YES 0 YES YES ID12104 23 FEMALE TOWN 20375.4 YES 3 NO NO attribute labelID
  • 61. http://dataminingtrend.com http://facebook.com/datacube.th Value type • ค่าของข้อมูลที่เก็บในแต่ละแอตทริบิวต์ • Polynominal ข้อมูลประเภท category (ข้อมูลที่ไม่ใช่ตัวเลข) มีค่ามากกว่า 2 ค่าขึ้น ไป • Binominal ข้อมูลประเภท category (ข้อมูลที่ไม่ใช่ตัวเลข) มีค่าเพียง 2 ค่าเท่านั้น • Numeric หรือ Integer ข้อมูลประเภทตัวเลข • Text ข้อมูลประเภทข้อความ 61 numericpolynominal customer_id age gender region income married children car response ID12101 48 FEMALE INNER_CITY 17546.0 NO 1 NO NO ID12102 40 MALE TOWN 30085.1 YES 3 YES NO ID12103 51 FEMALE INNER_CITY 16575.4 YES 0 YES YES ID12104 23 FEMALE TOWN 20375.4 YES 3 NO NO numeric numeric binominalbinominal binominal
  • 62. http://dataminingtrend.com http://facebook.com/datacube.th Data management • Repository • เป็นที่เก็บข้อมูลและ process เพื่อใช้งานใน RapidMiner 
 Studio 7 • ทำให้ไม่ต้องโหลดข้อมูลจากไฟล์ใหม่ทุกครั้ง • องค์ประกอบในส่วน Repository • ส่วนที่ • สำหรับสร้าง Repository ใหม่ • โหลดไฟล์ประเภทต่างๆ เข้าไปไว้ใน Repository • สร้างโฟลเดอร์ใหม่ • ส่วนที่ • ข้อมูลและ process Sample ที่ RapidMiner Studio 7 เตรียมไว้ให้ • ข้อมูลที่เก็บอยู่ในแต่ละ Repository 62 1 2 1 2
  • 63. http://dataminingtrend.com http://facebook.com/datacube.th Data management • สร้าง Repository ใหม่ • คลิกที่ • หลังจากนั้นเลือกเมนู Create repository 63 2 1 2
  • 64. http://dataminingtrend.com http://facebook.com/datacube.th Data management • สร้าง Repository ใหม่ (ต่อ) • เลือก New local repository • กดปุ่ม Next 64 3 4
  • 65. http://dataminingtrend.com http://facebook.com/datacube.th • สร้าง Repository ใหม่ (ต่อ) • เปลี่ยนชื่อ Alias เป็น RapidMinerTraining • กดปุ่ม Finish Data management 65 6 5
  • 66. http://dataminingtrend.com http://facebook.com/datacube.th Data management • จะปรากฏ repository RapidMinerTraining แสดงขึ้นมาในส่วนของ Repository 66 repository ที่ สร้างขึ้นมาใหม่
  • 67. http://dataminingtrend.com http://facebook.com/datacube.th Data management • สร้างโฟลเดอร์ใน RapidMinerTraining • data สำหรับเก็บข้อมูล 67 7 8 9 10
  • 68. http://dataminingtrend.com http://facebook.com/datacube.th Data management • สร้างโฟลเดอร์ใน RapidMinerTraining • data สำหรับเก็บข้อมูล • process สำหรับเก็บโพรเซสที่สร้างขึ้น 68 11 12 13 14
  • 69. http://dataminingtrend.com http://facebook.com/datacube.th • ไฟล์ประเภท csv ย่อมาจาก Comma Separated Value • ใช้เครื่องหมาย , (comma) คั่นระหว่างแอตทริบิวต์ customer_id age gender region income married children car response ID12101 48 FEMALE INNER_CITY 17546.0 NO 1 NO NO ID12102 40 MALE TOWN 30085.1 YES 3 YES NO ID12103 51 FEMALE INNER_CITY 16575.4 YES 0 YES YES ID12104 23 FEMALE TOWN 20375.4 YES 3 NO NO CSV File 69 customer_id,age,gender,region,income,married,children,ca,response ID12101,48,FEMALE,INNER_CITY,17546.0,NO,1,NO,NO ID12102,40,MALE,TOWN,30085.1,YES,3,YES,NO ID12103,51,FEMALE,INNER_CITY,16575.4,YES,0,YES,YES ID12104,23,FEMALE,TOWN,20375.4,YES,3,NO,NO แถวแรกคือ header
  • 70. http://dataminingtrend.com http://facebook.com/datacube.th CSV File • ไฟล์ csv สามารถ export ได้จาก Excel หรือ database ต่างๆ • Export จาก Excel • เลือก File > Save As > CSV (Comma delimited) 70
  • 71. http://dataminingtrend.com http://facebook.com/datacube.th Load CSV to RapidMiner • การโหลดไฟล์ csv เข้าไปใช้ใน RapidMiner Studio 7 ทำได้ 2 แบบ • ใช้การ import ในส่วนของ Repositories • โหลดมาเก็บไว้ใน Repository และใช้งาน
 ได้ตลอด • ถ้าข้อมูลในไฟล์ csv มีการเปลี่ยนแปลงจะ
 ไม่ update ต้องทำการโหลดใหม่ • ใช้โอเปอเรเตอร์ Read CSV • โหลดเข้ามาใช้งานโดยการอ่านจากไฟล์ csv 
 ทุกครั้ง เมื่อไฟล์ update ข้อมูลจะเปลี่ยนตาม 71
  • 72. http://dataminingtrend.com http://facebook.com/datacube.th Data preparation • การจัดการข้อมูล (preprocessing) • การเลือกแอตทริบิวต์ • เลือกตามประเภทของแอตทริบิวต์ • เลือกบางแอตทริบิวต์ • การเลือกข้อมูล (example) ตามเงื่อนไข • การ join ข้อมูลจาก 2 ชุด • มีความผิดพลาดในชุดข้อมูล เช่น • ข้อมูลมีค่าไม่ตรงกัน • ข้อมูลขาดขายไป • ข้อมูลแปลกแยก (outlier) 72 • การแปลงข้อมูล • Discretization แปลงข้อมูล numeric ให้เป็น nominal • แบ่งตามเงื่อนไขที่กำหนด (user defined) • แบ่งตามความถี่ที่เท่ากัน (equal frequency)
  • 73. http://dataminingtrend.com http://facebook.com/datacube.th Outlier 73 หมายเลข อายุ รายได้ เพศ 1 15 15,000 ชาย 2 20 15,000 ชาย 3 20 20,000 ชาย 4 20 25,000 หญิง 5 25 25,000 หญิง 6 40 35,000 ชาย 7 45 40,000 หญิง 8 45 45,000 ชาย 9 50 35,000 ชาย 10 50 50,000 หญิง ข้อมูลลูกค้า 10 15 20 25 30 35 40 45 50 55 60 65 10,000 15,000 20,000 25,000 30,000 35,000 40,000 45,000 50,000 55,000 60,000 65,000 รายได้ อายุ scatter plot ของข้อมูลลูกค้า เพศชาย เพศหญิง
  • 74. http://dataminingtrend.com http://facebook.com/datacube.th Outlier 74 หมายเลข อายุ รายได้ เพศ 1 15 15,000 ชาย 2 20 15,000 ชาย 3 20 20,000 ชาย 4 20 25,000 หญิง 5 25 25,000 หญิง 6 40 35,000 ชาย 7 45 40,000 หญิง 8 45 45,000 ชาย 9 50 35,000 ชาย 10 50 50,000 หญิง 11 10 65,000 ชาย 12 65 10,000 หญิง ข้อมูลลูกค้า scatter plot ของข้อมูลลูกค้า 10 15 20 25 30 35 40 45 50 55 60 65 10,000 15,000 20,000 25,000 30,000 35,000 40,000 45,000 50,000 55,000 60,000 65,000 รายได้ อายุ เพศชาย เพศหญิง outlier outlier
  • 75. http://dataminingtrend.com http://facebook.com/datacube.th Detect outlier by distance • วัดระยะห่างระหว่างข้อมูล (example) แต่ละตัวกับข้อมูลใกล้เคียง • outlier คือ ข้อมูลที่มีระยะห่างกับข้อมูลอื่นๆ มากๆ 75 10 15 20 25 30 35 40 45 50 55 60 65 10,000 15,000 20,000 25,000 30,000 35,000 40,000 45,000 50,000 55,000 60,000 65,000 รายได้ อายุ เพศชาย เพศหญิง d1>d2 d2 d3>d4 d4 scatter plot ของข้อมูลลูกค้า
  • 76. http://dataminingtrend.com http://facebook.com/datacube.th Detect outlier by distance • โอเปอเรเตอร์ที่เกี่ยวข้อง 76 โอเปอเรเตอร์ คำอธิบาย Generate Data ใช้สำหรับสร้างข้อมูล Detect Outlier (Distances) ใช้ในการหา outlier ด้วยวิธีดูจากระยะห่างระหว่างข้อมูล Filter Examples ลบข้อมูลตามเงื่อนไขที่กำหนด
  • 77. http://dataminingtrend.com http://facebook.com/datacube.th Detect outlier by distance • เลือกตัวอย่าง Process ที่ RapidMiner Studio 7 เตรียมไว้ให้ • เลือก Samples > Processes > 02_Preprocessing > 17_OutlierDetection 77 1 double click เพื่อ โหลด process 2
  • 78. http://dataminingtrend.com http://facebook.com/datacube.th Detect outlier by distance • แสดงข้อมูลแบบ scatter plot 78 3 4
  • 79. http://dataminingtrend.com http://facebook.com/datacube.th Detect outlier by distance • แสดงข้อมูล outlier ใน scatter plot 79 outlier 6 5
  • 80. http://dataminingtrend.com http://facebook.com/datacube.th Detect outlier by distance • ลบข้อมูลที่เป็น outlier ทิ้ง 80
  • 82. http://dataminingtrend.com http://facebook.com/datacube.th Market Basket Analysis • เริ่มจากการสังเกตุการซื้อสินค้าของลูกค้าแต่ละราย • วิเคราะห์ข้อมูลเพื่อดูว่า สินค้าอะไรบ้างที่ลูกค้ามักจะซื้อร่วมกันบ่อยๆ • ใช้ในการออกโปรโมชันเพ่ือเพิ่มยอดขาย 82 image source:http://www.computerrepairanaheim.net https://commons.wikimedia.org/wiki/File%3AShopping_cart_with_food_clip_art_2.svg
  • 84. http://dataminingtrend.com http://facebook.com/datacube.th Market Basket Analysis • แปลงข้อมูลจาก POS database เป็น transaction database โดย group by ตามเวลาที่ซื้อสินค้า 84 TID Transaction time Product 1 01-13-2014 20:04 Apple 1 01-13-2014 20:04 Cereal 1 01-13-2014 20:04 Diapers 2 01-14-2014 11:30 Beer 2 01-14-2014 11:30 Cereal 2 01-14-2014 11:30 Eggs 3 01-15-2014 14:30 Apple 3 01-15-2014 14:30 Beer 3 01-15-2014 14:30 Cereal 3 01-15-2014 14:30 Eggs 4 01-16-2014 14:15 Beer 4 01-16-2014 14:15 Eggs Transaction ID Items 1 Apple, Cereal, Diapers 2 Beer, Cereal, Eggs 3 Apple, Beer, Cereal, Eggs 4 Beer, Eggs
  • 85. http://dataminingtrend.com http://facebook.com/datacube.th Market Basket Analysis • Support • นับจำนวนครั้งการซื้อสินค้าแต่ละชนิดคิดเป็น % ของการซื้อสินค้า • Apple พบว่ามีการซื้อในครั้งที่ 1 และ 3 support(Apple) คือ 2/4 = 50% • Beer พบว่ามีการซื้อในครั้งที่ 2, 3 และ 4 support(Beer) คือ 3/4 = 75% 85 Transaction ID Items 1 Apple, Cereal, Diapers 2 Beer, Cereal, Eggs 3 Apple, Beer, Cereal, Eggs 4 Beer, Eggs Items Transaction ID Support 1 2 3 4 Apple 1 0 1 0 2/4 = 50% Beer 0 1 1 1 3/4 = 75% Cereal 1 1 1 0 3/4 = 75% Diapers 1 0 0 0 1/4 = 25% Eggs 0 1 1 1 3/4 = 75%
  • 86. http://dataminingtrend.com http://facebook.com/datacube.th Market Basket Analysis • frequent itemset • รูปแบบของการซื้อสินค้า (itemset) ที่มีค่า support > mininum support • กำหนดค่า minimum support = 50% ตัวอย่างของ Frequent Itemset คือ {Apple}, {Beer}, {Cereal}, {Eggs} • infrequent itemset • รูปแบบของการซื้อสินค้า (itemset) ที่มีค่า support < mininum support 86 Transaction ID Items 1 Apple, Cereal, Diapers 2 Beer, Cereal, Eggs 3 Apple, Beer, Cereal, Eggs 4 Beer, Eggs Items Transaction ID Support 1 2 3 4 Apple 1 0 1 0 2/4 = 50% Beer 0 1 1 1 3/4 = 75% Cereal 1 1 1 0 3/4 = 75% Diapers 1 0 0 0 1/4 = 25% Eggs 0 1 1 1 3/4 = 75%
  • 87. http://dataminingtrend.com http://facebook.com/datacube.th Market Basket Analysis • สินค้าใน supermarket มีจำนวน 3 ชนิด • Apple, Beer, Cereal • มีโอกาสที่เป็นไปได้ทั้งหมด (หรือ subset ทั้งหมด) คือ 23-1 = 7 รูปแบบ หรือ คำนวณได้จาก 2N-1 โดยที่ N คือ จำนวนของสินค้า (item) 87 CerealApple Apple, Cereal Beer Beer, CerealApple, Beer Apple, Beer, Cereal
  • 88. http://dataminingtrend.com http://facebook.com/datacube.th Market Basket Analysis • การหากฏความสัมพันธ์ (association rules) มี 2 ขั้นตอนใหญ่ๆ • ขั้นตอนที่ 1 หา frequent itemset ซึ่งใช้เวลานานกว่าขั้นตอนที่ 2 • มี 2 เทคนิคที่นิยมใช้ คือ • เทคนิค Apriori • เทคนิค FP-Growth • ขั้นตอนที่ 2 สร้างกฏความสัมพันธ์จาก frequent itemset ที่หาได้จากขั้นตอนที่ 1 88
  • 89. http://dataminingtrend.com http://facebook.com/datacube.th Market Basket Analysis • เทคนิคการหากฏความสัมพันธ์ (Association Rules) • Apriori (Agrawal and Srikant, 1994) • สร้างรูปแบบของสินค้า (itemset) ที่มีจำนวนเพิ่มขึ้นทีละ 1 • คำนวณค่า support จากในฐานข้อมูล • ข้อเสียคือต้องดึงข้อมูลจากฐานข้อมูลหลายรอบทำให้ทำงานช้า • FP-Growth (Han, Pei and Yin, 2000) • อ่านข้อมูลในฐานข้อมูลและสร้าง FP-tree • คำนวณค่า support จาก FP-tree • ทำงานได้เร็วกว่าวิธี Apriori 89 • J. Han, H. Pei, and Y. Yin. Mining Frequent Patterns without Candidate Generation. In: Proc. Conf. on the Management of Data (SIGMOD’00, Dallas, TX). ACM Press, New York, NY, USA 2000 • R. Agrawal and R. Srikant, Fast algorithms for mining association rules in large databases, Proceedings of the 20th International Conference on Very Large Data Bases, VLDB, pages 487-499, Santiago, Chile, September 1994
  • 90. http://dataminingtrend.com http://facebook.com/datacube.th • รูปแบบ (pattern) ที่มีสินค้า 2 ชนิด • รูปแบบที่มี Apple อยู่ Apriori 90 Apple {Apple, Beer} Beer Cereal Eggs Items Transaction ID Support 1 2 3 4 Apple 1 0 1 0 2/4 = 50% Beer 0 1 1 1 3/4 = 75% Itemset Transaction ID Support 1 2 3 4 {Apple, Beer} 0 0 1 0 1/4 = 25%
  • 91. http://dataminingtrend.com http://facebook.com/datacube.th • รูปแบบ (pattern) ที่มีสินค้า 2 ชนิด • รูปแบบที่มี Cereal อยู่ Apriori 91 {Cereal, Eggs} Items Transaction ID Support 1 2 3 4 Cereal 1 1 1 0 3/4 = 75% Eggs 0 1 1 1 3/4 = 75% Itemset Transaction ID Support 1 2 3 4 {Cereal, Eggs} 0 1 1 0 2/4 = 50% Apple Eggs Cereal Beer
  • 92. http://dataminingtrend.com http://facebook.com/datacube.th Apriori • นับจำนวนครั้งการซื้อสินค้า 2 ชนิด • {Apple, Beer}, {Apple, Cereal}, {Apple, Eggs} • {Beer, Cereal}, {Beer, Eggs} • {Cereal, Eggs} 92 Itemset Transaction ID Support 1 2 3 4 {Apple, Beer} 0 0 1 0 1/4 = 25% {Apple, Cereal} 1 0 1 0 2/4 = 50% {Apple, Eggs} 0 0 1 0 1/4 = 25% {Beer, Cereal} 0 1 1 0 2/4 = 50% {Beer, Eggs} 0 1 1 1 3/4 = 75% {Cereal, Eggs} 0 1 1 0 2/4 = 50% Itemset Transaction ID Support 1 2 3 4 {Apple, Beer} 0 0 1 0 1/4 = 25% {Apple, Cereal} 1 0 1 0 2/4 = 50% {Apple, Eggs} 0 0 1 0 1/4 = 25% {Beer, Cereal} 0 1 1 0 2/4 = 50% {Beer, Eggs} 0 1 1 1 3/4 = 75% {Cereal, Eggs} 0 1 1 0 2/4 = 50% Apple Beer Cereal Eggs Apple Beer Cereal Eggs
  • 93. http://dataminingtrend.com http://facebook.com/datacube.th Apriori • สินค้าที่มีการซื้อมากกว่าหรือเท่ากับ 50% เรียกว่า frequent itemset 93 Frequent itemset Support Size {Apple} 2/4 = 50% 1 {Beer} 3/4 = 75% 1 {Cereal} 3/4 = 75% 1 {Eggs} 3/4 = 75% 1 {Apple, Cereal} 2/4 = 50% 2 {Beer, Cereal} 2/4 = 50% 2 {Beer, Eggs} 3/4 = 75% 2 {Cereal, Eggs} 2/4 = 50% 2 {Beer, Cereal, Eggs} 2/4 = 50% 3
  • 94. http://dataminingtrend.com http://facebook.com/datacube.th FP-Growth • ขั้นตอนที่ 1 สร้าง compact data structure ที่เรียกว่า FP-tree • การสร้าง FP-Tree อ่านข้อมูลจากฐานข้อมูลเพียงแค่ 2 ครั้งเท่านั้น • หาค่า support ของรูปแบบการซื้อสินค้า (item) ที่มีความยาว 1 • เรียงลำดับตามค่า support ที่คำนวณได้ • สร้าง FP-Tree จากการอ่านข้อมูลในฐานข้อมูลเพียงหนึ่งรอบ 94 Transaction ID Items 1 Cereal, Apple, Diapers 2 Beer, Cereal, Eggs 3 Beer, Cereal, Eggs, Apple 4 Beer, Eggs Cereal:1 NULL Item support 
 count
  • 95. http://dataminingtrend.com http://facebook.com/datacube.th FP-Growth • ขั้นตอนที่ 1 สร้าง compact data structure ที่เรียกว่า FP-tree • การสร้าง FP-Tree อ่านข้อมูลจากฐานข้อมูลเพียงแค่ 2 ครั้งเท่านั้น • หาค่า support ของรูปแบบการซื้อสินค้า (item) ที่มีความยาว 1 • เรียงลำดับตามค่า support ที่คำนวณได้ • สร้าง FP-Tree จากการอ่านข้อมูลในฐานข้อมูลเพียงหนึ่งรอบ 95 Transaction ID Items 1 Cereal, Apple, Diapers 2 Beer, Cereal, Eggs 3 Beer, Cereal, Eggs, Apple 4 Beer, Eggs Cereal:1 NULL Apple:1
  • 96. http://dataminingtrend.com http://facebook.com/datacube.th FP-Growth • ขั้นตอนที่ 1 สร้าง compact data structure ที่เรียกว่า FP-tree • การสร้าง FP-Tree อ่านข้อมูลจากฐานข้อมูลเพียงแค่ 2 ครั้งเท่านั้น • หาค่า support ของรูปแบบการซื้อสินค้า (item) ที่มีความยาว 1 • เรียงลำดับตามค่า support ที่คำนวณได้ • สร้าง FP-Tree จากการอ่านข้อมูลในฐานข้อมูลเพียงหนึ่งรอบ 96 Transaction ID Items 1 Cereal, Apple, Diapers 2 Beer, Cereal, Eggs 3 Beer, Cereal, Eggs, Apple 4 Beer, Eggs Diapers:1 Cereal:1 NULL Apple:1
  • 97. http://dataminingtrend.com http://facebook.com/datacube.th Apriori & FP-Growth 97 Frequent itemset Support {Apple} 2/4 = 50% {Apple, Cereal} 2/4 = 50% {Eggs} 3/4 = 75% {Cereal, Eggs} 2/4 = 50% {Beer, Eggs} 3/4 = 75% {Beer, Cereal, Eggs} 2/4 = 50% {Cereal} 3/4 = 75% {Beer, Cereal} 2/4 = 50% {Beer} 3/4 = 75% Frequent itemset Support {Apple} 2/4 = 50% {Beer} 3/4 = 75% {Cereal} 3/4 = 75% {Eggs} 3/4 = 75% {Apple, Cereal} 2/4 = 50% {Beer, Cereal} 2/4 = 50% {Beer, Eggs} 3/4 = 75% {Cereal, Eggs} 2/4 = 50% {Beer, Cereal, Eggs} 2/4 = 50% ผลลัพธ์จาก Apriori ผลลัพธ์จาก FP-Growth
  • 98. http://dataminingtrend.com http://facebook.com/datacube.th Association rules • กฏความสัมพันธ์ (association rules) • สร้างจากสินค้าที่ลูกค้าซื้อบ่อยๆ • รูปแบบของกฏความสัมพันธ์ คือ • LHS คือ Left Hand Side สินค้าที่ซื้อพร้อมกันบ่อยๆ ด้านซ้ายของกฏ • RHS คือ Right Hand Side สินค้าที่ซื้อพร้อมกันบ่อยๆ ด้านขวาของกฏ 98 Frequent itemset Support Size {Apple, Cereal} 2/4 = 50% 2 {Beer, Cereal} 2/4 = 50% 2 {Beer, Eggs} 3/4 = 75% 2 {Cereal, Eggs} 2/4 = 50% 2 {Beer, Cereal, Eggs} 2/4 = 50% 3 LHS RHS Apple Cereal Beer Eggs Eggs Beer Cereal Apple Beer Cereal Cereal Eggs Cereal, Eggs Beer
  • 99. http://dataminingtrend.com http://facebook.com/datacube.th Association rules • ตัววัดประสิทธิภาพของกฏความสัมพันธ์ • Confidence • แสดงความเชื่อมั่นของกฏความสัมพันธ์ที่เมื่อรูปแบบ LHS เกิดขึ้นแล้วรูปแบบ RHS จะ เกิดขึ้นด้วยเป็นจำนวนกี่เปอร์เซ็นต์ 99 confidence(LHS RHS) = support(LHS, RHS) support(LHS) confidence(Apple Cereal) = support(Apple, Cereal) support(Apple) = 2/4 2/4 = 100%
  • 100. http://dataminingtrend.com http://facebook.com/datacube.th • โหลดไฟล์ pos.csv จาก thumb drive เข้าไปใน Repositories • แปลงข้อมูลจาก POS database เป็นตาราง TID Transaction time Product 1 01-13-2014 20:04 Apple 1 01-13-2014 20:04 Cereal 1 01-13-2014 20:04 Diapers 2 01-14-2014 11:30 Beer 2 01-14-2014 11:30 Cereal 2 01-14-2014 11:30 Eggs 3 01-15-2014 14:30 Apple 3 01-15-2014 14:30 Beer 3 01-15-2014 14:30 Cereal 3 01-15-2014 14:30 Eggs 4 01-16-2014 14:15 Beer 4 01-16-2014 14:15 Eggs TID Apple Beer Cereal Diapers Eggs 1 TRUE FALSE TRUE TRUE FALSE 2 FALSE TRUE TRUE FALSE TRUE 3 TRUE TRUE TRUE FALSE TRUE 4 FALSE TRUE FALSE FALSE TRUE Data preparation in RM 7 100
  • 101. http://dataminingtrend.com http://facebook.com/datacube.th Data preparation in RM 7 • โอเปอเรเตอร์ที่เกี่ยวข้อง 101 โอเปอเรเตอร์ คำอธิบาย Retrieve ใช้สำหรับดึงข้อมูลออกมาจาก Repositories Pivot ใช้สำหรับสร้างตารางในรูปแบบ Pivot Numerical to Binominal ใช้สำหรับแปลงข้อมูลตัวเลขให้เป็นประเภท Binominal
  • 102. http://dataminingtrend.com http://facebook.com/datacube.th Data preparation in RM 7 • เปลี่ยนพารามิเตอร์ของโอเปอเรเตอร์ Pivot ดังนี้ • group attribute เป็นค่า id • index attribute เป็นค่า name 102 1 3 4 2 facebook.com/datacube.th
  • 103. http://dataminingtrend.com http://facebook.com/datacube.th Data preparation in RM 7 • เลือกโอเปอเรเตอร์ Numerical to Binominal มาใส่ใน Process • เนื่องจากการหากฏความสัมพันธ์ไม่สามารถทำงานกับตัวเลข (numeric) ได้ครับ • เพื่อแปลงข้อมูลตัวเลข ให้เป็นค่า TRUE/FALSE 103 5 3 4 6 facebook.com/datacube.th
  • 104. http://dataminingtrend.com http://facebook.com/datacube.th Data preparation in RM 7 • ผลการแปลงจาก POS database 104 facebook.com/datacube.th
  • 105. http://dataminingtrend.com http://facebook.com/datacube.th Association rules in RM 7 • โอเปอเรเตอร์ที่เกี่ยวข้อง 105 โอเปอเรเตอร์ คำอธิบาย FP-Growth ใช้สำหรับหา frequent itemset ด้วยเทคนิค FP-Growth Create Association Rules ใช้สำหรับสร้างกฏความสัมพันธ์จาก frequent itemset ที่ ค้นพบ
  • 106. http://dataminingtrend.com http://facebook.com/datacube.th Association rules in RM 7 • ใช้ข้อมูลที่แปลงได้เพื่อหากฏความสัมพันธ์ • ใช้โอเปอเรเตอร์ FP-Growth เพื่อหา frequent itemset • เปลี่ยนพารามิเตอร์ min support เป็น 0.5 หรือ 50% 106 7 8 9 facebook.com/datacube.th
  • 107. http://dataminingtrend.com http://facebook.com/datacube.th Association rules in RM 7 • ใช้โอเปอเรเตอร์ Create Association Rules เพื่อสร้างกฏ
 ความสัมพันธ์ • เปลี่ยนพารามิเตอร์ min confidence เป็น 0.6 หรือ 60% 107 12 11 10 facebook.com/datacube.th
  • 108. http://dataminingtrend.com http://facebook.com/datacube.th Association rules in RM 7 • แสดง frequent itemset ที่หาได้ 108 ส่วน filter ส่วน frequent itemset คลิกที่ header ของแต่ละ คอลัมน์เพื่อ sort
  • 109. http://dataminingtrend.com http://facebook.com/datacube.th Association rules in RM 7 • แสดงกฏความสัมพันธ์ที่หาได้ 109 ส่วน filter ส่วนแสดงกฏความสัมพันธ์
  • 114. http://dataminingtrend.com http://facebook.com/datacube.th Customer profile • การใช้งานโทรศัพท์มือถือของลูกค้า 114 1 2 3 5 6 4 image source: http://www.iconarchive.com/show/vista-people-icons-by-icons-land.html
  • 115. http://dataminingtrend.com http://facebook.com/datacube.th Customer profile • หลังจากทำการแบ่งกลุ่มลูกค้าตามพฤติกรรมการใช้งาน 115 1 6 4 5 2 3 ลูกค้าที่ใช้โทรเยอะ ลูกค้าที่ส่ง SMS เยอะ ลูกค้าที่ใช้งานไม่เยอะ image source: http://www.iconarchive.com/show/vista-people-icons-by-icons-land.html
  • 116. http://dataminingtrend.com http://facebook.com/datacube.th • Clustering คือ การแบ่งกลุ่มข้อมูล • ข้อมูลที่มีลักษณะคล้ายๆ กัน อยู่กลุ่มเดียวกัน • ข้อมูลที่อยู่คนละกลุ่มจะมีลักษณะที่แตกต่างกันมากๆ • แต่ละกลุ่มจะเรียกว่า คลัสเตอร์ (cluster) What is clustering? 116 คลัสเตอร์ 1 คลัสเตอร์ 2 คลัสเตอร์ 3
  • 117. http://dataminingtrend.com http://facebook.com/datacube.th • การจัดข้อมูลให้อยู่ในกลุ่มต่างๆ จะต้องมีการวัดค่าความคล้าย
 คลึง (similarity) หรือ ค่าระยะห่าง (distance) ระหว่างข้อมูลแต่ละตัว • ค่าระยะห่างที่นิยมใช้ • ระยะห่างยูคลิเดียน (Euclidean distance) • ผมรวมของระยะห่างกำลังสอง A Distance function 117 Euclidean distance = √(XB - XA)2 + (YB - YA)2 B (XB,YB) (XA,YA) (XB - XA) (YB - YA)
  • 118. http://dataminingtrend.com http://facebook.com/datacube.th Clustering example • ทำการ clustering ลูกค้าตามพฤติกรรมการใช้งาน SMS และ 
 Phone 118 ID SMS Phone 1 27 144 2 32 44 3 41 30 4 125 21 5 105 23 6 20 121 20 40 60 80 100 120 140 160 20 40 SMS Phone 60 80 100 120 140 160 ใช้ sms เยอะ ใช้โทรศัพท์เยอะ ใช้แบบทั่วไปd35 d16 1 3 2 4 5 6
  • 119. http://dataminingtrend.com http://facebook.com/datacube.th • กำหนด K = 3 • กำหนดให้ข้อมูลหมายเลข 1,3,5 เป็นจุดศูนย์กลางของแต่ละคลัสเตอร์ • คำนวณระยะห่างระหว่างจุดศูนย์กลางของคลัสเตอร์ 12 K-Means 119 ID SMS Phone Center 1 27 144 X 2 32 44 - 3 41 30 X 4 125 21 - 5 105 23 X 6 20 121 - 20 40 60 80 100 120 140 160 20 40 SMS Phone 60 80 100 120 140 160 d61 3 4 6 d21 d41 5 d65d25 d45 d43 d23 d63
  • 120. http://dataminingtrend.com http://facebook.com/datacube.th • ผลการแบ่งคลัสเตอร์ • คลัสเตอร์ที่ 1 ประกอบด้วยข้อมูลหมายเลข 1,6 • คลัสเตอร์ที่ 2 ประกอบด้วยข้อมูลหมายเลข 2,3 • คลัสเตอร์ที่ 3 ประกอบด้วยข้อมูลหมายเลข 4,5 K-Means 120 4 1 3 2 6 20 40 60 80 100 120 140 160 20 40 SMS Phone 60 80 100 120 140 160 5 ใช้ sms เยอะ ใช้โทรศัพท์เยอะใช้แบบทั่วไป
  • 122. http://dataminingtrend.com http://facebook.com/datacube.th K-Means • ทำการสุ่มข้อมูล 3 ตัวเพื่อเป็นจุดศูนย์กลางของคลัสเตอร์ 122 facebook.com/datacube.th
  • 125. http://dataminingtrend.com http://facebook.com/datacube.th Clustering validity • การวัดประสิทธิภาพของ clustering • ปรับเปลี่ยนจำนวนกลุ่มของคลัสเตอร์ (ค่า K) • plot กราฟระหว่างจำนวนกลุ่มของคลัสเตอร์กับค่า Average within centroid distance • จำนวนกลุ่มที่เหมาะสมคือจุดที่เป็น elbow point 125 K Avg within distance 2 2865.90 3 1605.40 4 1051.10 5 769.44 6 600.68 7 490.88 6 417.71 9 365.09 10 326.50 0.00 500.00 1000.00 1500.00 2000.00 2500.00 3000.00 จำนวนคลัสเตอร์ (K) 2 3 4 5 6 7 8 9 10 Averagewithincentroiddistance elbow point
  • 126. http://dataminingtrend.com http://facebook.com/datacube.th K-Means in RM 7 • โหลดไฟล์ tel_usage.csv เข้าไปใน Repositories 126 1 2
  • 127. http://dataminingtrend.com http://facebook.com/datacube.th K-Means in RM 7 • โอเปอเรเตอร์ที่เกี่ยวข้องกับ K-Means 127 โอเปอเรเตอร์ คำอธิบาย Retrieve ใช้สำหรับดึงข้อมูลออกมาจาก Repositories K-Means ใช้สำหรับแบ่งกลุ่มข้อมูลด้วยเทคนิค K-Means
  • 128. http://dataminingtrend.com http://facebook.com/datacube.th K-Means in RM 7 • โหลด tel_usage จาก Repositories • กำหนดจำนวนกลุ่มของ K-Means ให้เป็น 3 กลุ่ม 128 2 1 4 3 facebook.com/datacube.th
  • 129. http://dataminingtrend.com http://facebook.com/datacube.th K-Means in RM 7 • ผลการแบ่งกลุ่มข้อมูลออกเป็น 3 คลัสเตอร์ 129 คลัสเตอร์ facebook.com/datacube.th
  • 130. http://dataminingtrend.com http://facebook.com/datacube.th K-Means in RM 7 • แสดงการกระจายตัวของข้อมูลในแต่ละคลัสเตอร์ 130 6 7 ใช้โทรศัพท์เยอะ ใช้ SMS เยอะ ใช้แบบทั่วไป facebook.com/datacube.th
  • 131. http://dataminingtrend.com http://facebook.com/datacube.th K-Means in RM 7 • แสดงจุดศูนย์กลางของแต่ละคลัสเตอร์ (centroid) • บอกลักษณะรูปแบบของข้อมูลที่อยู่ในคลัสเตอร์นั้นๆ 131 8 จุดศูนย์กลางของคลัสเตอร์ facebook.com/datacube.th
  • 132. http://dataminingtrend.com http://facebook.com/datacube.th Clustering techniques • เทคนิคที่นิยมใช้ในการทำ clustering • K-Means • เป็นประเภท partitional clustering • Agglomerative Clustering • เป็นประเภท hierarchical clustering • DBSCAN — Density Based Spatial Clustering of Applications with Noise • เป็นประเภท density-based clustering 132
  • 133. http://dataminingtrend.com http://facebook.com/datacube.th DBSCAN • เป็นวิธีการทำ clustering ด้วยการพิจารณาจำนวนข้อมูลที่อยู่ใน
 รัศมีที่กำหนด • ช่วยแก้ปัญหาของ partitional clustering เช่น K-Means 133 ข้อมูล ผลการแบ่งคลัสเตอร์ด้วย K-Means
  • 134. http://dataminingtrend.com http://facebook.com/datacube.th DBSCAN • ผลการแบ่งกลุ่มข้อมูลด้วยเทคนิค DBSCAN 134 ข้อมูล ผลการแบ่งคลัสเตอร์ด้วย DBSCAN facebook.com/datacube.th
  • 136. http://dataminingtrend.com http://facebook.com/datacube.th Classification in daily life • การพยากรณ์อากาศ 136 สภาพอากาศวันปัจจุบัน สภาพอากาศวันถัดไป
  • 137. http://dataminingtrend.com http://facebook.com/datacube.th Classification in daily life • speech recognition 137 image source: http://blog.spoken.com/ivr/
  • 138. http://dataminingtrend.com http://facebook.com/datacube.th Classification in daily life • face recognition 138 image source: http://www.bloomberg.com/news/articles/2012-06-18/facebook-buys-face-com-adds-facial-recognition-software
  • 140. http://dataminingtrend.com http://facebook.com/datacube.th Classification example • ตัวอย่าง spam e-mail classification • ระบุว่า e-mail ไหนบ้างที่เป็น spam e-mail 140 ID Text Type 1 Please call our customer service representative on FREE PHONE 0808 145 4742 between 9am-11pm as you have WON a guaranteed £1000 cash 2 You have won $1,000 cash or a $2,000 prize! To claim, call 09050000327 3 I'm gonna be home soon and I don't want to talk about this stuff anymore tonight 4 Is that seriously how you spell his name? 5 Double mins and txts 4 6months FREE Bluetooth on Orange. Available on Sony, Nokia Motorola phones. 6 FREE RINGTONE text FIRST to 87131 for a poly or text GET to 87131 for a true tone! 7 Sorry, I'll you call later in meeting. 8 Congratulations - in this week's competition draw u have won the £1450 prize to claim just call 09050002311 9 Thanks a lot for your wishes on my birthday. Thanks you for making my birthday truly memorable. 10 Hello, What are you doing? Did you attend the training course today? spam spam normal normal normal normal spam spam spam normal
  • 141. http://dataminingtrend.com http://facebook.com/datacube.th Classification example • ตัวอย่าง spam e-mail classification • ระบุว่า e-mail ไหนบ้างที่เป็น spam e-mail 141 ID Text Type 1 Please call our customer service representative on FREE PHONE 0808 145 4742 between 9am-11pm as you have WON a guaranteed £1000 cash spam 2 You have won $1,000 cash or a $2,000 prize! To claim, call 09050000327 spam 3 I'm gonna be home soon and I don't want to talk about this stuff anymore tonight normal 4 Is that seriously how you spell his name? normal 5 Double mins and txts 4 6months FREE Bluetooth on Orange. Available on Sony, Nokia Motorola phones. spam 6 FREE RINGTONE text FIRST to 87131 for a poly or text GET to 87131 for a true tone! spam 7 Sorry, I'll you call later in meeting. normal 8 Congratulations - in this week's competition draw u have won the £1450 prize to claim just call 09050002311 spam 9 Thanks a lot for your wishes on my birthday. Thanks you for making my birthday truly memorable. normal 10 Hello, What are you doing? Did you attend the training course today? normal
  • 142. http://dataminingtrend.com http://facebook.com/datacube.th Classification example • ตัวอย่าง spam e-mail classification • หา keyword ที่ใช้บ่งบอกว่าเป็น spam e-mail 142 ID Free Won Cash Type 1 Y Y Y spam 2 N Y Y spam 3 N N N normal 4 N N N normal 5 Y N N spam 6 Y N N spam 7 N N N normal 8 N Y N spam 9 N N N normal 10 N N N normal ID Text Type 1 Please call our customer service representative on FREE PHONE 0808 145 4742 between 9am-11pm as you have WON a guaranteed £1000 cash spam 2 You have won $1,000 cash or a $2,000 prize! To claim, call 09050000327 spam 3 I'm gonna be home soon and I don't want to talk about this stuff anymore tonight normal 4 Is that seriously how you spell his name? normal 5 Double mins and txts 4 6months FREE Bluetooth on Orange. Available on Sony, Nokia Motorola phones. spam … … … keywords
  • 143. http://dataminingtrend.com http://facebook.com/datacube.th Classification example • ตัวอย่าง spam e-mail classification • สร้างโมเดล (classification model) จากข้อมูล training data ซึ่งมีลาเบล (label) 143 ID Free Won Cash Type 1 Y Y Y spam 2 N Y Y spam 3 N N N normal 4 N N N normal 5 Y N N spam 6 Y N N spam 7 N N N normal 8 N Y N spam 9 N N N normal 10 N N N normal attribute label Free Won Normal Spam Spam classification model = N = Y = N = Y training data
  • 144. http://dataminingtrend.com http://facebook.com/datacube.th Classification example • ตัวอย่าง spam e-mail classification • นำข้อมูลใหม่ (unseen data) ทำนายโดยใช้โมเดล 144 attribute Free Won Normal Spam Spam classification model = N = Y = N = Y training data ID Free Won Cash Type 11 Y Y N ? 12 N Y N ?
  • 145. http://dataminingtrend.com http://facebook.com/datacube.th Classification example • ตัวอย่าง spam e-mail classification • นำข้อมูลใหม่ (unseen data) ทำนายโดยใช้โมเดล 145 attribute Free Won Normal Spam Spam classification model = N = Y = N = Y training data ID Free Won Cash Type 11 Y Y N ? 12 N Y N ?
  • 146. http://dataminingtrend.com http://facebook.com/datacube.th Classification example • ตัวอย่าง spam e-mail classification • นำข้อมูลใหม่ (unseen data) ทำนายโดยใช้โมเดล 146 attribute Free Won Normal Spam Spam classification model = N = Y = N = Y training data ID Free Won Cash Type 11 Y Y N ? 12 N Y N ?
  • 147. http://dataminingtrend.com http://facebook.com/datacube.th • ตัวอย่าง spam e-mail classification ID Free Won Cash Type 1 Y Y Y spam 2 N Y Y spam 3 N N N normal 4 N N N normal 5 Y N N spam Classification example 147 attribute labelID training data สร้าง classification model ID Free Won Cash Type 11 Y Y N ? 12 N Y N ? unseen data classification model ID Type 11 spam 12 spam 1 2 3 4
  • 148. http://dataminingtrend.com http://facebook.com/datacube.th Classification & Regression • การจำแนกประเภทข้อมูล (classification) • นำข้อมูลเดิมที่มีคำตอบที่สนใจ หรือ คลาส (class) มาสร้างเป็นโมเดล (model) เพื่อ หาคำตอบให้กับข้อมูลใหม่ (unseen data) • คลาสคำตอบเป็น ประเภท (nominal) • ฝนตก หรือ ไม่ตก • spam email หรือ normal email • การประมาณค่าข้อมูล (regression) • มีลักษณะเหมือนกับ classification เพียงแต่คลาสคำตอบที่สนใจเป็น ตัวเลข (numeric) • อุณหภูมิในวันถัดไป • ยอดขายในไตรมาสถัดไป 148
  • 149. http://dataminingtrend.com http://facebook.com/datacube.th • การสร้างโมเดลและการทดสอบประสิทธิภาพ Classification & Regression task 149 สร้าง 
 classification model prediction results classification model ID Type Predicted 1 spam spam 2 spam spam 3 normal normal 1 training data testing data ID Free Won Cash Type 1 Y Y Y spam 2 N Y Y spam 3 N N N normal ID Free Won Cash Type 1 Y Y Y spam 2 N Y Y spam 3 N N N normal 2 3 4 facebook.com/datacube.th facebook.com/datacube.th
  • 150. http://dataminingtrend.com http://facebook.com/datacube.th Performance (classification) • ตัววัดประสิทธิิภาพของโมเดล classification • Confusion Matrix • True Positive (TP), True Negative (TN) • False Positive (FP), False Negative (FN) • Precision and Recall • Accuracy • F-Measure • ROC Graph & Area Under Curve (AUC) 150
  • 151. http://dataminingtrend.com http://facebook.com/datacube.th Performance (classification) • พิจารณาคลาส normal • True Positive (TP) • True Negative (TN) • False Positive (FP) • False Negative (FN) 151 ID Type Predicted 1 spam spam 2 spam spam 3 normal normal 4 normal spam 5 spam spam 6 spam spam 7 normal spam 8 spam normal 9 normal normal 10 normal normal 11 spam spam 12 spam spam 13 spam normal 14 spam normal 15 normal normal ID Type Predicted 1 spam spam 2 spam spam 3 normal normal 4 normal spam 5 spam spam 6 spam spam 7 normal spam 8 spam normal 9 normal normal 10 normal normal 11 spam spam 12 spam spam 13 spam normal 14 spam normal 15 normal normal pred.true. normal spam normal TP FP spam FN TN dataminingtrend.com
  • 152. http://dataminingtrend.com http://facebook.com/datacube.th Performance (classification) • พิจารณาคลาส normal • True Positive (TP) • จำนวนที่ทำนายตรงกับข้อมูลจริงใน คลาสที่กำลังพิจารณา • True Negative (TN) • False Positive (FP) • False Negative (FN) 152 ID Type Predicted 1 spam spam 2 spam spam 3 normal normal 4 normal spam 5 spam spam 6 spam spam 7 normal spam 8 spam normal 9 normal normal 10 normal normal 11 spam spam 12 spam spam 13 spam normal 14 spam normal 15 normal normal ID Type Predicted 1 spam spam 2 spam spam 3 normal normal 4 normal spam 5 spam spam 6 spam spam 7 normal spam 8 spam normal 9 normal normal 10 normal normal 11 spam spam 12 spam spam 13 spam normal 14 spam normal 15 normal normal pred.true. normal spam normal 4 FP spam FN TN dataminingtrend.com
  • 153. http://dataminingtrend.com http://facebook.com/datacube.th Performance (classification) • พิจารณาคลาส normal • True Positive (TP) • True Negative (TN) • จำนวนที่ทำนายตรงกับข้อมูลจริงใน คลาสที่ไม่ได้กำลังพิจารณา • False Positive (FP) • False Negative (FN) 153 ID Type Predicted 1 spam spam 2 spam spam 3 normal normal 4 normal spam 5 spam spam 6 spam spam 7 normal spam 8 spam normal 9 normal normal 10 normal normal 11 spam spam 12 spam spam 13 spam normal 14 spam normal 15 normal normal ID Type Predicted 1 spam spam 2 spam spam 3 normal normal 4 normal spam 5 spam spam 6 spam spam 7 normal spam 8 spam normal 9 normal normal 10 normal normal 11 spam spam 12 spam spam 13 spam normal 14 spam normal 15 normal normal pred.true. normal spam normal 4 FP spam FN 6 dataminingtrend.com
  • 154. http://dataminingtrend.com http://facebook.com/datacube.th Performance (classification) • พิจารณาคลาส normal • True Positive (TP) • True Negative (TN) • False Positive (FP) • จำนวนที่ทำนายผิดเป็นคลาสที่กำลัง พิจารณา • False Negative (FN) 154 ID Type Predicted 1 spam spam 2 spam spam 3 normal normal 4 normal spam 5 spam spam 6 spam spam 7 normal spam 8 spam normal 9 normal normal 10 normal normal 11 spam spam 12 spam spam 13 spam normal 14 spam normal 15 normal normal ID Type Predicted 1 spam spam 2 spam spam 3 normal normal 4 normal spam 5 spam spam 6 spam spam 7 normal spam 8 spam normal 9 normal normal 10 normal normal 11 spam spam 12 spam spam 13 spam normal 14 spam normal 15 normal normal pred.true. normal spam normal 4 3 spam FN 6 dataminingtrend.com
  • 155. http://dataminingtrend.com http://facebook.com/datacube.th Performance (classification) • พิจารณาคลาส normal • True Positive (TP) • True Negative (TN) • False Positive (FP) • False Negative (FN) • จำนวนที่ทำนายผิดเป็นคลาสที่ไม่ได้ กำลังพิจารณา 155 ID Type Predicted 1 spam spam 2 spam spam 3 normal normal 4 normal spam 5 spam spam 6 spam spam 7 normal spam 8 spam normal 9 normal normal 10 normal normal 11 spam spam 12 spam spam 13 spam normal 14 spam normal 15 normal normal ID Type Predicted 1 spam spam 2 spam spam 3 normal normal 4 normal spam 5 spam spam 6 spam spam 7 normal spam 8 spam normal 9 normal normal 10 normal normal 11 spam spam 12 spam spam 13 spam normal 14 spam normal 15 normal normal pred.true. normal spam normal 4 3 spam 2 6 dataminingtrend.com
  • 156. http://dataminingtrend.com http://facebook.com/datacube.th Performance (classification) • ตัววัดประสิทธิิภาพของโมเดล classification • Confusion Matrix • True Positive (TP), True Negative (TN) • False Positive (FP), False Negative (FN) • Precision and Recall • F-Measure • Accuracy • ROC Graph & Area Under Curve (AUC) 156
  • 157. http://dataminingtrend.com http://facebook.com/datacube.th Performance (classification) • Precision • จำนวนที่ทำนายถูกจากข้อมูลที่ ทำนายว่าเป็นคลาสที่พิจารณาอยู่ • Precision สำหรับ normal • True Positive
 True Positive + False Positive • 4/7 x 100 = 57.12% • Precision สำหรับ spam • 6/8 x 100 = 75% 157 ID Type Predicted 3 normal normal 8 spam normal 9 normal normal 10 normal normal 13 spam normal 14 spam normal 15 normal normal pred.true. normal spam normal TP FP spam FN TN Precision ID Type Predicted 1 spam spam 2 spam spam 4 normal spam 5 spam spam 6 spam spam 7 normal spam 11 spam spam 12 spam spam predict เป็นคลาส spam predict เป็นคลาส normal confusion matrix ของคลาส normal
  • 158. http://dataminingtrend.com http://facebook.com/datacube.th Performance (classification) • Recall • จำนวนข้อมูลที่ทำนายถูก • Recall สำหรับ normal • True Positive
 True Positive + False Negative • 4/6 x 100 = 66.67% • Recall สำหรับ spam • 7/9 x 100 = 77.78% 158 pred.true. normal spam normal TP FP spam FN TN คลาส spam คลาส normal confusion matrix ของคลาส normal Recall ID Type Predicted 3 normal normal 4 normal spam 7 normal spam 9 normal normal 10 normal normal 15 normal normal ID Type Predicted 1 spam spam 2 spam spam 5 spam spam 6 spam spam 8 spam normal 11 spam spam 12 spam spam 13 spam normal 14 spam spam
  • 159. http://dataminingtrend.com http://facebook.com/datacube.th Performance (classification) • ตัววัดประสิทธิิภาพของโมเดล classification • Confusion Matrix • True Positive (TP), True Negative (TN) • False Positive (FP), False Negative (FN) • Precision and Recall • F-Measure • Accuracy • ROC Graph & Area Under Curve (AUC) 159
  • 160. http://dataminingtrend.com http://facebook.com/datacube.th Performance (classification) • F-Measure • ค่าเฉลี่ยของ Precision และ Recall • 2 x Precision x Recall 
 Precision + Recall • F-Measure สำหรับ normal • 2 x 57.12 x 66.67 = 61.53%
 57.12 + 66.67 • F-Measure สำหรับ spam • 2 x 75 x 77.8 = 76.37%
 75 + 77.8 160 ID Type Predicted 3 normal normal 8 spam normal 9 normal normal 10 normal normal 13 spam normal 14 spam normal 15 normal normal Precision = 4/7 x 100 = 57.12% Recall = 4/6 x 100 = 66.67% ID Type Predicted 3 normal normal 4 normal spam 7 normal spam 9 normal normal 10 normal normal 15 normal normal
  • 161. http://dataminingtrend.com http://facebook.com/datacube.th Performance (classification) • ตัววัดประสิทธิิภาพของโมเดล classification • Confusion Matrix • True Positive (TP), True Negative (TN) • False Positive (FP), False Negative (FN) • Precision and Recall • F-Measure • Accuracy • ROC Graph & Area 161
  • 162. http://dataminingtrend.com http://facebook.com/datacube.th Performance (classification) • Accuracy • จำนวนข้อมูลที่ทำนายถูกของทุก
 คลาส • True Positive + True Negative
 True Positive + True Negative + False Positive + False Negative • 10/15 x 100 =66.67% 162 pred.true. normal spam normal TP FP spam FN TN Accuracy ID Type Predicted 1 spam spam 2 spam spam 3 normal normal 4 normal spam 5 spam spam 6 spam spam 7 normal spam 8 spam normal 9 normal normal 10 normal normal 11 spam spam 12 spam spam 13 spam normal 14 spam normal 15 normal normal dataminingtrend.com
  • 163. http://dataminingtrend.com http://facebook.com/datacube.th Performance (classification) • ตัววัดประสิทธิิภาพของโมเดล classification • Confusion Matrix • True Positive (TP), True Negative (TN) • False Positive (FP), False Negative (FN) • Precision and Recall • F-Measure • Accuracy • ROC Graph & Area Under Curve (AUC) 163
  • 164. http://dataminingtrend.com http://facebook.com/datacube.th ROC Graph & Area • Receiver Operating Characteristics (ROC) แสดงกราฟความ สัมพันธ์ระหว่างข้อมูลที่ทำนายถูก (แกน Y) และทำนายผิด (แกน X) 164 ID Type Predicted Score TP rate FP rate 1 normal spam 0.80 1.00 1.00 2 spam spam 0.85 1.00 0.66 4 normal spam 0.87 0.80 0.66 5 spam spam 0.90 0.80 0.33 6 spam spam 0.92 0.60 0.33 7 normal spam 0.95 0.40 0.33 11 spam spam 0.95 0.40 0.00 12 spam spam 0.99 0.20 0.00 0.1 0.3 0.4 0.5 0.6 0.7 0.1 0.2 False Positive Rate (FP rate) 0.3 0.4 0.5 0.6 0.7 True Positive rate (TP rate) 0.2 0.8 0.9 1.0 0.8 0.9 1.0
  • 165. http://dataminingtrend.com http://facebook.com/datacube.th ROC Graph & Area • Receiver Operating Characteristics (ROC) แสดงกราฟความ สัมพันธ์ระหว่างข้อมูลที่ทำนายถูก (แกน Y) และทำนายผิด (แกน X) 165 ID Type Predicted Score TP rate FP rate 1 normal spam 0.80 1.00 1.00 2 spam spam 0.85 1.00 0.66 4 normal spam 0.87 0.80 0.66 5 spam spam 0.90 0.80 0.33 6 spam spam 0.92 0.60 0.33 7 normal spam 0.95 0.40 0.33 11 spam spam 0.98 0.40 0.00 12 spam spam 0.99 0.20 0.00 0.1 0.3 0.4 0.5 0.6 0.7 0.1 0.2 False Positive Rate (FP rate) 0.3 0.4 0.5 0.6 0.7 True Positive rate (TP rate) 0.2 0.8 0.9 1.0 0.8 0.9 1.0
  • 166. http://dataminingtrend.com http://facebook.com/datacube.th ROC Graph & Area • Receiver Operating Characteristics (ROC) แสดงกราฟความ สัมพันธ์ระหว่างข้อมูลที่ทำนายถูก (แกน Y) และทำนายผิด (แกน X) 166 ID Type Predicted Score TP rate FP rate 1 normal spam 0.80 1.00 1.00 2 spam spam 0.85 1.00 0.66 4 normal spam 0.87 0.80 0.66 5 spam spam 0.90 0.80 0.33 6 spam spam 0.92 0.60 0.33 7 normal spam 0.95 0.40 0.33 11 spam spam 0.98 0.40 0.00 12 spam spam 0.99 0.20 0.00 0.1 0.3 0.4 0.5 0.6 0.7 0.1 0.2 False Positive Rate (FP rate) 0.3 0.4 0.5 0.6 0.7 True Positive rate (TP rate) 0.2 0.8 0.9 1.0 0.8 0.9 1.0
  • 167. http://dataminingtrend.com http://facebook.com/datacube.th ROC Graph & Area • Receiver Operating Characteristics (ROC) แสดงกราฟความ สัมพันธ์ระหว่างข้อมูลที่ทำนายถูก (แกน Y) และทำนายผิด (แกน X) 167 ID Type Predicted Score TP rate FP rate 1 normal spam 0.80 1.00 1.00 2 spam spam 0.85 1.00 0.66 4 normal spam 0.87 0.80 0.66 5 spam spam 0.90 0.80 0.33 6 spam spam 0.92 0.60 0.33 7 normal spam 0.95 0.40 0.33 11 spam spam 0.98 0.40 0.00 12 spam spam 0.99 0.20 0.00 0.1 0.3 0.4 0.5 0.6 0.7 0.1 0.2 False Positive Rate (FP rate) 0.3 0.4 0.5 0.6 0.7 True Positive rate (TP rate) 0.2 0.8 0.9 1.0 0.8 0.9 1.0
  • 168. http://dataminingtrend.com http://facebook.com/datacube.th ROC Graph & Area • Receiver Operating Characteristics (ROC) แสดงกราฟความ สัมพันธ์ระหว่างข้อมูลที่ทำนายถูก (แกน Y) และทำนายผิด (แกน X) 168 ID Type Predicted Score TP rate FP rate 1 normal spam 0.80 1.00 1.00 2 spam spam 0.85 1.00 0.66 4 normal spam 0.87 0.80 0.66 5 spam spam 0.90 0.80 0.33 6 spam spam 0.92 0.60 0.33 7 normal spam 0.95 0.40 0.33 11 spam spam 0.98 0.40 0.00 12 spam spam 0.99 0.20 0.00 0.1 0.3 0.4 0.5 0.6 0.7 0.1 0.2 False Positive Rate (FP rate) 0.3 0.4 0.5 0.6 0.7 True Positive rate (TP rate) 0.2 0.8 0.9 1.0 0.8 0.9 1.0
  • 169. http://dataminingtrend.com http://facebook.com/datacube.th ROC Graph & Area • Receiver Operating Characteristics (ROC) แสดงกราฟความ สัมพันธ์ระหว่างข้อมูลที่ทำนายถูก (แกน Y) และทำนายผิด (แกน X) 169 ID Type Predicted Score TP rate FP rate 1 normal spam 0.80 1.00 1.00 2 spam spam 0.85 1.00 0.66 4 normal spam 0.87 0.80 0.66 5 spam spam 0.90 0.80 0.33 6 spam spam 0.92 0.60 0.33 7 normal spam 0.95 0.40 0.33 11 spam spam 0.98 0.40 0.00 12 spam spam 0.99 0.20 0.00 0.1 0.3 0.4 0.5 0.6 0.7 0.1 0.2 False Positive Rate (FP rate) 0.3 0.4 0.5 0.6 0.7 True Positive rate (TP rate) 0.2 0.8 0.9 1.0 0.8 0.9 1.0
  • 170. http://dataminingtrend.com http://facebook.com/datacube.th ROC Graph & Area • Receiver Operating Characteristics (ROC) แสดงกราฟความ สัมพันธ์ระหว่างข้อมูลที่ทำนายถูก (แกน Y) และทำนายผิด (แกน X) 170 ID Type Predicted Score TP rate FP rate 1 normal spam 0.80 1.00 1.00 2 spam spam 0.85 1.00 0.66 4 normal spam 0.87 0.80 0.66 5 spam spam 0.90 0.80 0.33 6 spam spam 0.92 0.60 0.33 7 normal spam 0.95 0.40 0.33 11 spam spam 0.98 0.40 0.00 12 spam spam 0.99 0.20 0.00 0.1 0.3 0.4 0.5 0.6 0.7 0.1 0.2 False Positive Rate (FP rate) 0.3 0.4 0.5 0.6 0.7 True Positive rate (TP rate) 0.2 0.8 0.9 1.0 0.8 0.9 1.0
  • 171. http://dataminingtrend.com http://facebook.com/datacube.th ROC Graph & Area • Receiver Operating Characteristics (ROC) แสดงกราฟความ สัมพันธ์ระหว่างข้อมูลที่ทำนายถูก (แกน Y) และทำนายผิด (แกน X) 171 ID Type Predicted Score TP rate FP rate 1 normal spam 0.80 1.00 1.00 2 spam spam 0.85 1.00 0.66 4 normal spam 0.87 0.80 0.66 5 spam spam 0.90 0.80 0.33 6 spam spam 0.92 0.60 0.33 7 normal spam 0.95 0.40 0.33 11 spam spam 0.98 0.40 0.00 12 spam spam 0.99 0.20 0.00 0.1 0.3 0.4 0.5 0.6 0.7 0.1 0.2 False Positive Rate (FP rate) 0.3 0.4 0.5 0.6 0.7 True Positive rate (TP rate) 0.2 0.8 0.9 1.0 0.8 0.9 1.0
  • 172. http://dataminingtrend.com http://facebook.com/datacube.th ROC Graph & Area • Receiver Operating Characteristics (ROC) แสดงกราฟความ สัมพันธ์ระหว่างข้อมูลที่ทำนายถูก (แกน Y) และทำนายผิด (แกน X) 172 ID Type Predicted Score TP rate FP rate 1 normal spam 0.80 1.00 1.00 2 spam spam 0.85 1.00 0.66 4 normal spam 0.87 0.80 0.66 5 spam spam 0.90 0.80 0.33 6 spam spam 0.92 0.60 0.33 7 normal spam 0.95 0.40 0.33 11 spam spam 0.98 0.40 0.00 12 spam spam 0.99 0.20 0.00 0.1 0.3 0.4 0.5 0.6 0.7 0.1 0.2 False Positive Rate (FP rate) 0.3 0.4 0.5 0.6 0.7 True Positive rate (TP rate) 0.2 0.8 0.9 1.0 0.8 0.9 1.0 ROC Curve