Bài giảng khai phá dữ liệu (data mining) association rule

76 5 0
Bài giảng khai phá dữ liệu (data mining) association rule

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

Trịnh Tấn Đạt Khoa CNTT – Đại Học Sài Gòn Email: trinhtandat@sgu.edu.vn Website: https://sites.google.com/site/ttdat88/ Nội dung  Giới thiệu luật kết hợp  Các ứng dụng  Định nghĩa mơ hình hóa tốn  Thuật tốn Apriori  Bài Tập Data mining  Data mining refers to extracting knowledge from a large amount of data, in the other way we can say data mining is the process to discover various types of pattern that are inherited in the data and which are accurate, new and useful Data Mining Steps  The basic steps of data mining are follows  Data Collection  Data Cleaning  Data Analysis  Interpretation Data Mining Steps Data collection—The first step is to collect some data As much as information we have is good to make the analysis easier later We have to make sure that the source of data is reliable Data cleaning—Since we are getting a large amount of data, we need to make sure that we only have the necessary data and remove the unwanted Otherwise, they may lead us to false conclusions Data Mining Steps Data Analysis—As the name says the analysis and finding patterns is done here Interpretation—Finally the analyzed data is interpreted to take important conclusions like predictions Recommender Systems Applications Market basket analysis Online recommendation Apriori Algorithm ❖Step 2: Sinh luật kết hợp  Với frequent itemset I, sinh tất tập s không rỗng I  Với tập s không rỗng I, sinh luật s => (I-s) độ tin cậy (Confidence) > =min_conf ❖ Ví dụ:  Chẳng hạn với I= {A1,A2,A5},các tập I: {A1}, {A2}, {A5}, {A1,A2},{A1,A5},{A2,A5}  Ta có luật sau  {A1} => {A2,A5},{A2} =>{A1,A5},{A5} =>{A1,A2}  {A1,A2} =>{A5},{A1,A5} =>{A2},{A2,A5} => {A1} Apriori Algorithm  Ví dụ: Ta có frequent itemsets I ={B,C,E} Với min_conf =80% Ta có luật kết hợp  {B,C} => {E}  {C,E} => {B} Apriori Algorithm Apriori Algorithm Apriori Algorithm Ví dụ  Sinh luật cho tập phổ biến ABDE có mínup =3 minconf = 0.8  Các tập  Các luận thỏa điều kiện Ví dụ  Giả sử có sở liệu giao dịch bán hàng gồm giao dịch sau: Ví dụ  Thuật tốn Apriori tìm luật kết hợp giao dịch bán hàng sau: Ví dụ  Thuật tốn Apriori tìm luật kết hợp giao dịch bán hàng sau: Ví dụ  Thuật tốn Apriori tìm luật kết hợp giao dịch bán hàng sau: Ví dụ  Thuật tốn Apriori tìm luật kết hợp giao dịch bán hàng sau: Ví dụ  Thuật tốn Apriori tìm luật kết hợp giao dịch bán hàng sau: Thảo luận  Thuật toán Apriori dùng để phát luật kết hợp dạng khẳng định (Positive Rule X=>Y) nhị phân (Binary Association Rules)  Không thể phát luật kết hợp dạng phủ định (Negative Association Rule) chẳn hạn kết hợp dạng “Khách hàng mua mặt hàng A thường KHÔNG mua mặt hàng B” “Nếu ủng hộ quan điểm A thường KHÔNG ủng hộ quan điểm B”  Khai phá luật kết hợp dạng phủ định (Mining Negative Association Rules) có phạm vi ứng dụng rộng thú vị Marketing, Health Care Social Network Analysis Thảo luận ❖ Apriori: Các yếu tố ảnh hưởng độ phức tạp  Lựa chọn giá trị ngưỡng minsup  Giá trị minsup thấp sinh nhiều tập phổ biến  Điều làm tăng số lượng tập mục phải xét độ dài (kích thước) tối đa tập phổ biến  Số lượng mục sở liệu (các giao dịch)  Cần thêm nhớ để lưu giá trị độ hỗ trợ mục  Nếu số lượng mục (tập mục mức 1) thường xuyên tăng lên, chi phí I/O (duyệt giao dịch) tăng  Kích thước sở liệu (các giao dịch) chi phí tính tốn  Giải thuật Apriori duyệt sở liệu nhiều lần Do đó, chi phí tăng lên số lượng giao dịch tăng lên tính tốn Apriori Bài Tập 1) Cài đặt chương trình demo thuật tốn Apriori cho liệu bán hàng siêu thị a) Toy example: #Toy example transactions_2 = [ ['Bread', 'Milk', 'Chips', 'Mustard'], ['Beer', 'Diaper', 'Bread', 'Eggs'], ['Beer', 'Coke', 'Diaper', 'Milk'], ['Beer', 'Bread', 'Diaper', 'Milk','Chips'], ['Coke', 'Bread', 'Diaper', 'Milk'], ['Beer', 'Bread', 'Diaper', 'Milk','Mustard'], ['Coke', 'Bread', 'Diaper', 'Milk'], ] b) Store_data.csv  Dùng thư viện: apyori python Tham khảo: https://stackabuse.com/association-rule-mining-via-apriorialgorithm-in-python/

Ngày đăng: 23/12/2023, 10:13

Tài liệu cùng người dùng

Tài liệu liên quan