Classification Data mining การทำเหมืองข้อมูลแบบจำแนก

Download Report

Transcript Classification Data mining การทำเหมืองข้อมูลแบบจำแนก

การจาแนกข้ อมูล(Classification)
CART-Classification and regression Tree
อ.วิวฒั น์ ชินนาทศิริกลุ
เทคนิค Classification and regression trees (CART) คิดค้น
โดย Breiman ในปื ค.ศ.1984
ต้นไม้ตดั สิ นใจ ที่สร้างจากอัลกอริ ทึม CART จะเป็ นต้นไม้
แบบ binary ซึ่งประกอบด้วย กิ่งหรื อแขนง 2 กิ่ง สาหรับแต่ละ
โหนด
เทคนิคแบบ CART จะทาการแบ่ง เรคคอร์ดใน Training Data
Set ออกเป็ น เรคคอร์ดย่อย ที่ให้ค่าเป้ าหมาย (target) ที่เหมือนกัน
CART Algorithm
กาหนด
 (s \ t )
เป็ นหน่วยวัดค่าที่ดีที่สุดของ การแตกโหนด
คู่แข่ง s ที่โหนด t
โดยที่
 (s \ t )  2 PL PR
# classes

j 1
| P( j \ t L )  P ( j \ t R ) |
t L - โหนดลูกทางซ้ายของโหนด t
t R - โหนดลูกทางขวาของโหนด t
PL 
PR 
จานวนเรคคอร์ดที่โหนด tL
จานวนเรคคอร์ดใน Training Set
จานวนเรคคอร์ดที่โหนด tR
จานวนเรคคอร์ดใน Training Set
จานวนเรคคอร์ของคลาส j ที่ tL
จานวนเรคคอร์ที่ t
P( j \ tR )  จานวนเรคคอร์ ของคลาส j ที่ tR
จานวนเรคคอร์ที่ t
P( j \ t L ) 
ตัวอย่าง จาก Training Data Set ที่กาหนดให้ดงั ตาราง จะสร้าง Decision
Tree ด้วย CART
ขั้นตอนการทางาน
นาแอททริ บิวต์ Saving , Assets และ income มาสร้าง Candidate Split
ดังตาราง
For each candidate split, let us examine the values of the various
components of the optimality measure  (s|t )
The maximum observed value for
 (s|t ) among the candidate
splits is therefore attained by split 4, with
 (s|t ) = 0.6248.
CART therefore chooses to make the initial partition of the data set
using candidate split 4, assets=low versus assets  {medium , high}
ใน Candidate Split รายการที่ 4 มีค่า  (s \ t ) มากที่สุดคือ 0.6248
ดังนั้นจะใช้ Candidate Split รายการที่ 4 คือ Assets=low และ
Assets  {medium , high} เป็ น Root Node
ตารางแสดง Values of the Components of the Optimality Measure Φ(s |t )for
Each Candidate Split, for Decision Node A
Here two candidate splits (3 and 7) share the highest value for
Φ (s|t ), 0.4444. We arbitrarily select the first split encountered, split
3, savings = high versus savings  {low, medium}, for decision
node A
ภาพแสดง CART decision tree after decision node A split.
แบบฝึ กหัด
จากข้ อมูลทีก่ าหนดให้ ให้ นักศึกษาใช้ เทคนิค CART เพือ่ จาแนกเงินเดือน (Salary)
ข้อแนะนา เนื่องจากตัวเลขอายุ และรายได้มีหลากลายเกินไป ควรจัดกลุ่มอายุ และรายได้ เช่น
อายุ <30 ปี
รายได้ < 35000
อายุ 30-40 ปี
35000 <= รายได้ < 45000
อายุ >40 ปี
45000 <= รายได้ < 55000
รายได้ >55000