BÁO CÁO MÔN HỌC KHAI PHÁ DỮ LIỆUMô tả bài toán1.Mô tảCho cơ sơ dữ liệu SE (Sick-euthyroid cơ sở dữ liệu về bệnh tuyến giáp), bao gồm 26 thuộc tính và 3163 bộ dữ liệu2.Trích chọn đặc tínhMột số phương pháp chọn thuộc tính (Feature Selection Methods): Có rất nhiều phương pháp để lựa chọn thuộc tính tùy thuộc vào cấu trúc của dữ liệu dùng cho mô hình và thuật toán được dùng để xây dựng mô hình. Sau đây là một số phương pháp phổ biến dùng trong trích chọn thuộc tính:Interestingness score: Được sử dụng để xếp hạng (rank) các thuộc tính đối với các thuộc tính có kiểu dữ liệu liên tục (continuous). Một thuộc tính được xem là Interesting nếu nó mang một vài thông tin hữu ích (thế nào là thông tin hữu ích tùy thuộc vào vấn đề đang phân tích của bạn). Để đo lường mức độ interestingness, người ta thường dựa vào entropy (một thuộc tính với phân bố ngẫu nhiên có entropy cao hơn và có information gain (độ lợi thông tin) thấp hơn) vì vậy các thuộc tính đó gọi là less interesting). Entropy của một thuộc tính nào đó sẽ được so sánh với entropy của tất cả các thuộc tính còn lại theo công thức sau:Interestingness(Attribute) = - (m - Entropy(Attribute)) * (m - Entropy(Attribute)) Trong đó m gọi là entropy trung tâm (Central entropy- có nghĩa là entropy của toàn bộ tập thuộc tính)Shannon''s Entropy: Được sử dụng đối với các dữ liệu kiểu rời rạc (discretized data). Shannon''s entropy đo lường độ bất định (uncertainty) của biến ngẫu nhiên đối với một kết quả cụ thể (particular outcome). Ví dụ, entropy của việc tung một đồng xu có thể biểu diễn bằng một hàm của xác suất của khả năng xuất hiện mặt sấp hay ngửa. Shannon''s entropy được tính theo công thức sauH(X) = -∑ P(xi) log(P(xi)) Ngoài interestingness score và Shannon''s entropy, một số phương pháp khác cũng thường được sử dụng trong lựa chọn thuộc tính như Bayesian with K2 Prior, Bayesian Dirichlet Equivalent with Uniform Prior3.Trích chọn thuộc tính trong WekaTrong WEKA, một phương pháp lựa chọn thuộc tính (attribute selection) bao gồm2 phần:Attribute Evaluator Để xác định một phương pháp đánh giá mức • Attribute Evaluator. Để xác định một phương pháp đánh giá mức độ phù hợpcủa các thuộc tính Vd: correlation-based, wrapper, information gain, chisquared squared,…Search Method. Để xác định mộtphương pháp (thứ tự) xét các thuộc tính Vd: best-first, random, exhaustive, ranking,…
Trang 1Họ và tên: Nguyễn Đức Tuấn
Lớp: Công Nghệ Phần Mềm 6
BÁO CÁO MÔN HỌC KHAI PHÁ DỮ LIỆU
Mô tả bài toán
1.Mô tả
Cho cơ sơ dữ liệu SE (Sick-euthyroid cơ sở dữ liệu về bệnh tuyến giáp), bao gồm 26 thuộc tính và 3163 bộ dữ liệu
2.Trích chọn đặc tính
Một số phương pháp chọn thuộc tính (Feature Selection Methods): Có rất nhiều phương pháp để
lựa chọn thuộc tính tùy thuộc vào cấu trúc của dữ liệu dùng cho mô hình và thuật toán được dùng
để xây dựng mô hình Sau đây là một số phương pháp phổ biến dùng trong trích chọn thuộc tính:
Interestingness score: Được sử dụng để xếp hạng (rank) các thuộc tính đối với các thuộc tính có kiểu
dữ liệu liên tục (continuous) Một thuộc tính được xem là Interesting nếu nó mang một vài thông tinhữu ích (thế nào là thông tin hữu ích tùy thuộc vào vấn đề đang phân tích của bạn) Để đo lường
mức độ interestingness, người ta thường dựa vào entropy (một thuộc tính với phân bố ngẫu nhiên
có entropy cao hơn và có information gain (độ lợi thông tin) thấp hơn) vì vậy các thuộc tính đó gọi là
less interesting) Entropy của một thuộc tính nào đó sẽ được so sánh với entropy của tất cả các
thuộc tính còn lại theo công thức sau:
Interestingness(Attribute) = - (m - Entropy(Attribute)) * (m - Entropy(Attribute))
Trong đó m gọi là entropy trung tâm (Central entropy- có nghĩa là entropy của toàn bộ tập thuộctính)
Shannon's Entropy: Được sử dụng đối với các dữ liệu kiểu rời rạc (discretized data) Shannon's
entropy đo lường độ bất định (uncertainty) của biến ngẫu nhiên đối với một kết quả cụ thể(particular outcome) Ví dụ, entropy của việc tung một đồng xu có thể biểu diễn bằng một hàm của
xác suất của khả năng xuất hiện mặt sấp hay ngửa Shannon's entropy được tính theo công thức sau
H(X) = -∑ P(xi) log(P(xi))
Ngoài interestingness score và Shannon's entropy, một số phương pháp khác cũng thường được sử
dụng trong lựa chọn thuộc tính như Bayesian with K2 Prior, Bayesian Dirichlet Equivalent with Uniform Prior
3.Trích chọn thuộc tính trong Weka
Trong WEKA, một phương pháp lựa chọn thuộc tính (attribute selection) bao gồm2 phần:
Attribute Evaluator Để xác định một phương pháp đánh giá mức • Attribute Evaluator Để xác định một phương pháp đánh giá mức độ phù hợpcủa các thuộc tính
Trang 2Vd: correlation-based, wrapper, information gain, chisquared squared,…
Search Method Để xác định mộtphương pháp (thứ tự) xét các thuộc tính
Vd: best-first, random, exhaustive, ranking,…
Mở weka chọn dataset SE :
Chọn tab “Select attributes”, trong mục “Attribute Evaluaror” chọn WrapperSubsetEval, trong mục Classifier chọn NaiveBayes như hình sau
Trang 3Trong mục Search Method chọn GredySteepWise
Thu được kết quả
=== Run information ===
Trang 4Evaluator: weka.attributeSelection.WrapperSubsetEval -B weka.classifiers.bayes.NaiveBayes -F 5 -T0.01 -R 1
Trang 5=== Attribute Selection on all input data ===
Search Method:
Greedy Stepwise (backwards)
Start set: all attributes
Merit of best subset found: 0.037
Attribute Subset Evaluator (supervised, Class (nominal): 26 class):
Wrapper Subset Evaluator
Learning scheme: weka.classifiers.bayes.NaiveBayes
Scheme options:
Accuracy estimation: classification error
Number of folds for accuracy estimation: 5
Trang 64.Tiền xử lý dữ liệu
Loại bỏ các thuộc tính không cần thiết sau khi trích chọn thuộc tính query_on_thyroxine,on_antithyroid_medication, thyroid_surgery, query_hypothyroid, pregnant, tumor, lithium, goiter,T3_measured, T3, TT4_measured, T4U_measured, FTI, TBG_measured
Trình tự loại bỏ thuộc tính Filter > Choose > filters >unsupervised > attribute > Remove Ta thu được
kết quả
Lưu lại dữ liệu mới SE2.Ta sử dụng dataset này để phân lớp
Thuật toán phân lớp
1.Thực hiện thuật toán
Đối với dataset này chúng ta sử dụng thuật toán phân lớp: cây quyết định J48
Với dữ liệu chia thành 10 phần
Trang 7Kết quả:
=== Run information ===
Scheme:weka.classifiers.trees.J48 -C 0.25 -M 2
Relation: R1,2,3,8,10,14,15,19,21,22,25
Test mode:10-fold cross-validation
=== Classifier model (full training set) ===
J48 pruned tree
Trang 9
T3 > 1.1: negative (2620.88/23.0)
Number of Leaves : 15
Size of the tree : 29
Time taken to build model: 0.14seconds
=== Stratified cross-validation ===
=== Summary ===
Correctly Classified Instances 3076 97.2494 %
Incorrectly Classified Instances 87 2.7506 %
Kappa statistic 0.8391
Mean absolute error 0.0446
Root mean squared error 0.1572
Relative absolute error 26.4984 %
Root relative squared error 54.2187 %
Total Number of Instances 3163
=== Detailed Accuracy By Class ===
TP Rate FP Rate Precision Recall F-Measure ROC Area Class 0.87 0.017 0.839 0.87 0.854 0.934 sick-euthyroid 0.983 0.13 0.987 0.983 0.985 0.934 negative Weighted Avg 0.972 0.119 0.973 0.972 0.973 0.934
=== Confusion Matrix ===
a b < classified as
255 38 | a = sick-euthyroid
49 2821 | b = negative
Trang 10Với bộ dữ liệu chia tỷ lệ:66%, 34%
Kết quả
=== Run information ===
Scheme:weka.classifiers.trees.J48 -C 0.25 -M 2
Relation: R1,2,3,8,10,14,15,19,21,22,25
Trang 11FTI
TBG_measured
class
Test mode:split 66.0% train, remainder test
=== Classifier model (full training set) ===
Trang 12Size of the tree : 29
Time taken to build model: 0.14seconds
=== Evaluation on test split ===
=== Summary ===
Correctly Classified Instances 1056 98.2326 % Incorrectly Classified Instances 19 1.7674 % Kappa statistic 0.8938
Mean absolute error 0.039
Root mean squared error 0.1315
Relative absolute error 23.2133 %
Root relative squared error 45.6942 %
Total Number of Instances 1075
=== Detailed Accuracy By Class ===
Trang 13TP Rate FP Rate Precision Recall F-Measure ROC Area Class 0.908 0.01 0.899 0.908 0.904 0.973 sick-euthyroid 0.99 0.092 0.991 0.99 0.99 0.973 negative Weighted Avg 0.982 0.084 0.982 0.982 0.982 0.973
Trang 14Test mode:split 75.0% train, remainder test
=== Classifier model (full training set) ===
Trang 15Size of the tree : 29
Time taken to build model: 0.13seconds
=== Evaluation on test split ===
=== Summary ===
Correctly Classified Instances 772 97.598 % Incorrectly Classified Instances 19 2.402 % Kappa statistic 0.8539
Mean absolute error 0.0419
Root mean squared error 0.1496
Trang 16Relative absolute error 25.0062 %
Root relative squared error 51.9933 %
Total Number of Instances 791
=== Detailed Accuracy By Class ===
TP Rate FP Rate Precision Recall F-Measure ROC Area Class 0.861 0.013 0.873 0.861 0.867 0.937 sick-euthyroid 0.987 0.139 0.986 0.987 0.987 0.937 negative Weighted Avg 0.976 0.127 0.976 0.976 0.976 0.937
sick-euthyroid-weka.filters.unsupervised.attribute.Remove-Instances:3163
Trang 17Test mode:split 80.0% train, remainder test
=== Classifier model (full training set) ===
Trang 18Size of the tree : 29
Time taken to build model: 0.14seconds
=== Evaluation on test split ===
Trang 19=== Summary ===
Correctly Classified Instances 616 97.3144 %
Incorrectly Classified Instances 17 2.6856 %
Kappa statistic 0.8374
Mean absolute error 0.0435
Root mean squared error 0.1573
Relative absolute error 25.908 %
Root relative squared error 54.5172 %
Total Number of Instances 633
=== Detailed Accuracy By Class ===
TP Rate FP Rate Precision Recall F-Measure ROC Area Class 0.845 0.014 0.86 0.845 0.852 0.924 sick-euthyroid 0.986 0.155 0.984 0.986 0.985 0.924 negative Weighted Avg 0.973 0.142 0.973 0.973 0.973 0.924
Trang 20Kết quả:
=== Run information ===
Scheme:weka.classifiers.trees.J48 -C 0.25 -M 2
Relation: R1,2,3,8,10,14,15,19,21,22,25
Trang 21Test mode:split 85.0% train, remainder test
=== Classifier model (full training set) ===
Trang 22Time taken to build model: 0.15seconds
=== Evaluation on test split ===
=== Summary ===
Correctly Classified Instances 458 96.6245 %
Incorrectly Classified Instances 16 3.3755 %
Kappa statistic 0.8111
Mean absolute error 0.0497
Root mean squared error 0.175
Relative absolute error 28.7484 %
Root relative squared error 58.5393 %
Total Number of Instances 474
=== Detailed Accuracy By Class ===
TP Rate FP Rate Precision Recall F-Measure ROC Area Class 0.83 0.019 0.83 0.83 0.83 0.914 sick-euthyroid 0.981 0.17 0.981 0.981 0.981 0.914 negative
Trang 24Test mode:split 90.0% train, remainder test
=== Classifier model (full training set) ===
Trang 25Size of the tree : 29
Time taken to build model: 0.14seconds
=== Evaluation on test split ===
=== Summary ===
Correctly Classified Instances 305 96.519 % Incorrectly Classified Instances 11 3.481 % Kappa statistic 0.8164
Mean absolute error 0.0516
Root mean squared error 0.1765
Relative absolute error 29.1856 %
Root relative squared error 57.6733 %
Trang 26Total Number of Instances 316
=== Detailed Accuracy By Class ===
TP Rate FP Rate Precision Recall F-Measure ROC Area Class 0.848 0.021 0.824 0.848 0.836 0.916 sick-euthyroid 0.979 0.152 0.982 0.979 0.981 0.916 negative Weighted Avg 0.965 0.138 0.966 0.965 0.965 0.916
sick-euthyroid-weka.filters.unsupervised.attribute.Remove-Instances:3163
Attributes:15
query_on_thyroxine
Trang 27Test mode:split 50.0% train, remainder test
=== Classifier model (full training set) ===
Trang 28Time taken to build model: 0.14seconds
=== Evaluation on test split ===
=== Summary ===
Correctly Classified Instances 1539 97.3435 % Incorrectly Classified Instances 42 2.6565 % Kappa statistic 0.8425
Trang 29Mean absolute error 0.0472
Root mean squared error 0.1559
Relative absolute error 27.9944 %
Root relative squared error 52.877 %
Total Number of Instances 1581
=== Detailed Accuracy By Class ===
TP Rate FP Rate Precision Recall F-Measure ROC Area Class