(Luận văn thạc sĩ) nghiên cứu các kỹ thuật phân cụm dữ liệu và ứng dụng

102 27 0
(Luận văn thạc sĩ) nghiên cứu các kỹ thuật phân cụm dữ liệu và ứng dụng

Đ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

ĐẠI HỌC QUỐC GIA HÀ NỘI TRƯỜNG ĐẠI HỌC CÔNG NGHỆ =================== Nguyễn Thị Huế NGHIÊN CỨU CÁC KỸ THUẬT PHÂN CỤM DỮ LIỆU VÀ ỨNG DỤNG LUẬN VĂN THẠC SỸ HÀ NỘI - 2011 ĐẠI HỌC QUỐC GIA HÀ NỘI TRƯỜNG ĐẠI HỌC CÔNG NGHỆ ==================== Nguyễn Thị Huế NGHIÊN CỨU CÁC KỸ THUẬT PHÂN CỤM DỮ LIỆU VÀ ỨNG DỤNG Ngành: Công nghệ thông tin Chuyên ngành: Hệ thống thông tin Mã số: 60 48 05 LUẬN VĂN THẠC SỸ NGƯỜI HƯỚNG DẪN KHOA HỌC GS.TS Vũ Đức Thi HÀ NỘI – 2011 i LỜI CẢM ƠN Để hồn thành luận văn này, trước hết tơi xin gửi lời cảm ơn sâu sắc tới GS.TS Vũ Đức Thi, Viện trưởng Viện công nghệ thông tin tận tình hướng dẫn, bảo, định hướng, đóng góp ý kiến q báu suốt q trình tơi thực luận văn Tôi xin chân thành cảm ơn thầy, cô giáo Bộ môn Hệ thống thông tin, Khoa Cơng nghệ thơng tin, Phịng Đào tạo Sau đại học - Nghiên cứu Khoa học, Trường Đại học Công nghệ - Đại học Quốc gia Hà Nội tạo điều kiện tốt để tơi hồn thành khóa học Đồng thời, tơi xin cảm ơn gia đình, bạn bè, người ln khuyến khích giúp đỡ tơi hồn cảnh khó khăn Tơi xin cảm ơn quan đồng nghiệp tạo điều kiện cho suốt trình học tập làm luận văn Hà Nội, ngày 10 tháng 04 năm 2011 Học viên Nguyễn Thị Huế ii LỜI CAM ĐOAN Tôi xin cam đoan kiến thức trình bày luận văn tơi tìm hiểu, nghiên cứu trình bày lại theo cách hiểu tơi Trong q trình làm luận văn tơi có tham khảo tài liệu có liên quan ghi rõ nguồn tài liệu tham khảo Phần lớn kiến thức tơi trình bày luận văn chưa trình bày hồn chỉnh tài liệu Hà Nội, ngày 10 tháng 04 năm 2011 Học viên Nguyễn Thị Huế iii MỤC LỤC MỞ ĐẦU .1 Chương .3 TỔNG QUAN VỀ KHAI PHÁ TRI THỨC VÀ KHAI PHÁ DỮ LIỆU 1.1 Giới thiệu chung .3 1.2 Khai phá tri thức trình khai phá tri thức .3 1.2.1 Khai phá tri thức 1.2.2 Quá trình khai phá tri thức 1.3 Khai phá liệu .5 1.3.1 Khai phá liệu 1.3.2 Mục tiêu khai phá liệu 1.3.3 Quá trình khai phá liệu 1.3.4 Các hướng tiếp cận kỹ thuật áp dụng khai phá liệu 1.3.5 Thách thức – khó khăn khai phá tri thức khai phá liệu .13 1.3.6 Ứng dụng khai phá liệu .13 1.3.7 Kết luận 14 Chương PHÂN CỤM DỮ LIỆU VÀ CÁC THUẬT TOÁN TRONG 15 PHÂN CỤM DỮ LIỆU .15 2.1 Giới thiệu 15 2.2 Các ứng dụng phân cụm 16 2.3 Các yêu cầu thuật toán phân cụm liệu 17 2.4 Các kiểu liệu phân cụm 18 2.5 Phép đo độ tương tự khoảng cách kiểu liệu 21 2.6 Các hướng tiếp cận toán phân cụm liệu .28 2.6.1 Phương pháp phân hoạch (Partitioning Methods) .28 2.6.2 Phương pháp phân cấp (Hierarchical Methods) 36 2.6.3 Phương pháp dựa mật độ (Density-Based Methods) 44 2.6.4 Phương pháp dựa lưới (Gird-Based Methods) 51 2.6.5 Kết luận .56 Chương 3: ỨNG DỤNG 58 KẾT LUẬN .65 TÀI LIỆU THAM KHẢO 66 PHỤ LỤC 68 iv DANH MỤC CÁC KÝ HIỆU, TỪ VIẾT TẮT Từ cụm từ Cơ sở liệu Từ viết tắt CSDL Khai phá tri thức sở liệu KDD Từ tiếng Anh DataBase Knowledge Discovery in Databases Khai phá liệu KPDL Data Mining Phân cụm liệu PCDL Data Clustering Khai phá tri thức KPTT Knowledge Discovery v DANH MỤC HÌNH VẼ Hình 1.2: Q trình khai phá tri thức Hình 1.3: Qúa trình khai phá liệu Hình 2.1: Mơ hình phân cụm dựa tiêu chuẩn thu nhập số nợ 15 Hình 2.2: Khoảng cách Euclidean 24 Hình 2.3: Bảng tham số 26 Hình 2.4: Ví dụ q trình phân hoạch với k=3 30 Hình 2.6: Ví dụ số hình dạng cụm liệu khám phá K-means .32 Hình 2.7: Các chiến lược phân cụm phân cấp 37 Hình 2.8: Ví dụ kết phân cụm thuật toán BIRCH 39 Hình 2.9 Khái quát thuật toán CURE 41 Hình 2.10 Các cụm liệu khám phá CURE 41 Hình 2.11 Ví dụ thực phân cụm thuật tốn CURE 43 Hình 2.12: Các bước thuật tốn CHAMELEON 44 Hình 2.13: Hình dạng cụm khám phá DBSCAN 45 Hình 2.14: Mật độ - đến trực tiếp 46 Hình 2.15: Mật độ - đến 47 Hình 2.16: Mật độ - liên thơng 47 Hình 2.17: Cụm nhiễu .48 Hình 2.18: Mơ hình cấu trúc liệu lưới 52 Hình 2.19: Mơ hình thuật tốn STING 53 Hình 3.1: Kết phân cụm với Minpt = 3, Epxilon = 200000000 60 Hình 3.2: Kết phân cụm liệu thuộc tính đồ 61 Hình 3.3: Màu cụm thể đồ 61 Hình 3.4: Giao diện chương trình Phân cụm liệu thuật tốn DBSCAN .68 Hình 3.5: Giao diện chương trình sau thực hiên phân cụm .69 Hình 3.6: Kết phân cụm .70 MỞ ĐẦU Sự phát triển công nghệ thông tin việc ứng dụng công nghệ thông tin lĩnh vực đời sống, kinh tế, xã hội nhiều năm qua đồng nghĩa với lượng liệu quan thu thập lưu trữ ngày tích lũy nhiều lên Hơn nữa, công nghệ lưu trữ phục hồi liệu phát triển cách nhanh chóng sở liệu quan, doanh nghiệp, đơn vị ngày nhiều thông tin tiềm ẩn phong phú đa dạng Mặt khác, môi trường cạnh tranh, người ta ngày cần có nhiều thơng tin với tốc độ nhanh để trợ giúp việc định ngày có nhiều câu hỏi mang tính chất định tính cần phải trả lời dựa khối lượng liệu khổng lồ có Với lý vậy, phương pháp quản trị khai thác sở liệu truyền thống ngày không đáp ứng thực tế làm phát triển khuynh hướng kỹ thuật Kỹ thuật khai phá tri thức khai phá liệu (KDD - Knowledge Discovery and Data Mining) Khai phá tri thức sở liệu coi q trình tìm tri thức có ích, cần thiết, tiềm ẩn chưa biết trước sở liệu lớn (discovery of interesting, implicit, and previously unknown knowledge from large databases)[5] Kỹ thuật khai phá tri thức khai phá liệu nghiên cứu, ứng dụng nhiều lĩnh vực khác nước giới, Việt Nam kỹ thuật tương đối mẻ nhiên nghiên cứu dần đưa vào ứng dụng năm gần Những vấn đề quan tâm phân lớp nhận dạng mẫu, luật kết hợp, phân cụm liệu, phần tử dị biệt,… Phân cụm sở liệu phương pháp quan trọng trình tìm kiếm tri thức Phân cụm phương pháp học từ quan sát (learning from obversation) hay cịn gọi học khơng thầy (unupervised learning or automatic classfication) trí tuệ nhân tạo Phân cụm đặc biệt hiệu ta thông tin cụm, ta quan tâm tới thuộc tính cụm mà chưa biết biết thơng tin Phân cụm coi công cụ độc lập để xem xét phân bố liệu, làm bước tiền xử lý cho thuật tốn khác Việc phân cụm liệu có nhiều ứng dụng tiếp thị, sử dụng đất, bảo hiểm, hoạch định thành phố … Hiện nay, phân cụm liệu hướng nghiên cứu nhiều Tin học Chính lý mà em chọn đề tài ―Nghiên cứu kỹ thuật phân cụm liệu Ứng dụng‖ hướng nghiên cứu cho luận văn Nội dung luận văn trình bày chương: Chương 1: Tổng quan khai phá tri thức khai phá liệu Trong chương trình bày tổng quan khai phá tri thức, khai phá liệu; qui trình khai phá tri thức, khai phá liệu; … Chương 2: Phân cụm kỹ thuật phân cụm Trong chương trình bày tổng quan phân cụm liệu, số phương pháp phân cụm liệu liệu phổ biến phân cụm phân hoạch, phân cụm phân cấp, phân cụm dựa mật độ, phân cụm dựa lưới; trình bày số giải thuật điển hình phương pháp phân cụm; … Chương 3: Ứng dụng, triển khai toán với giải thuật DBSCAN Phần kết luận trình bày tóm tắt nội dung thực luận văn, đồng thời đưa vấn đề nghiên cứu tiếp cho tương lai Phần phụ lục trình bày số modul chương trình cài đặt thuật toán DBSCAN Do thời gian nghiên cứu trình độ có hạn, luận văn khơng tránh khỏi hạn chế thiếu sót Em mong nhận bảo, đóng góp ý kiến thầy thầy/ cô giáo bạn bè đồng nghiệp Em xin chân thành cảm ơn! Chƣơng TỔNG QUAN VỀ KHAI PHÁ TRI THỨC VÀ KHAI PHÁ DỮ LIỆU 1.1 Giới thiệu chung Cách mạng khoa học kỹ thuật tạo bước nhảy vọt tất lĩnh vực đời sống kinh tế, xã hội, … Một thành công không kể đến cách mạng bùng nổ thông tin, khiến cho khối lượng thông tin mà người thu thập lưu trữ ngày khổng lồ, kích thước CSDL tăng cách nhanh chóng Trong CSDL tiềm ẩn nhiều nhiều tri thức mà người chưa khám phá Đứng trước núi liệu khổng lồ thu thập được, việc khám phá tri thức thơng tin trở nên khó khăn Chính lý nhu cầu tìm kiếm tri thức khối CSDL nảy sinh, nhu cầu ngày cấp thiết dẫn tới hình thành lĩnh vực – lĩnh vực khai phá liệu (Data Mining) hay khai phá tri thức sở liệu (Knowledge Discovery in databases - KDD) Khai phá tri thức sở liệu coi q trình tìm tri thức có ích, cần thiết, tiềm ẩn chưa biết trước sở liệu lớn (discovery of interesting, implicit, and previously unknown knowledge from large databases) Tuy đời khai phá tri thức khai phá liệu nghiên cứu, ứng dụng nhiều lĩnh vực khác nước giới, Việt Nam kỹ thuật tương đối mẻ nhiên nghiên cứu dần đưa vào ứng dụng năm gần Những vấn đề quan tâm phân lớp nhận dạng mẫu, luật kết hợp, phân cụm liệu, phần tử dị biệt,… 1.2 Khai phá tri thức trình khai phá tri thức 1.2.1 Khai phá tri thức Khai phá hay phát tri thức sở liệu quy trình nhận biết mẫu mơ hình liệu với tính năng: Phân tích, tổng hợp, hợp thức, khả ích, hiểu Cịn khám phá liệu bước qui trình khám phá tri thức gồm có thuật tốn khai thác liệu chun dùng số qui định hiệu tính tốn chấp nhận để tìm mẫu 81 private ToolStripStatusLabel toolStripStatusLabel1; private AxToolbarControl axToolbarControl2; private int iKeyPressed=0; public Form1() { InitializeComponent(); } protected override void Dispose( bool disposing ) { if( disposing ) { if (components != null) { components.Dispose(); } } base.Dispose( disposing ); } #region Windows Form Designer generated code private void InitializeComponent() { this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1)); this.axMapControl1 = new ESRI.ArcGIS.Controls.AxMapControl(); this.axTOCControl = new ESRI.ArcGIS.Controls.AxTOCControl(); this.label4 = new System.Windows.Forms.Label(); this.cboField = new System.Windows.Forms.ComboBox(); this.label5 = new System.Windows.Forms.Label(); this.cboLayer = new System.Windows.Forms.ComboBox(); this.imgView = new System.Windows.Forms.ImageList(this.components); this.btn_OK = new System.Windows.Forms.Button(); this.axLicenseControl1 = new ESRI.ArcGIS.Controls.AxLicenseControl(); this.panel1 = new System.Windows.Forms.Panel(); this.txt_Epxilon = new System.Windows.Forms.TextBox(); this.txt_Minpt = new System.Windows.Forms.TextBox(); this.splitContainer1 = new System.Windows.Forms.SplitContainer(); this.tabControl1 = new System.Windows.Forms.TabControl(); this.tabPage1 = new System.Windows.Forms.TabPage(); this.tabPage2 = new System.Windows.Forms.TabPage(); this.dataGridView1 = new System.Windows.Forms.DataGridView(); this.axToolbarControl1 = new ESRI.ArcGIS.Controls.AxToolbarControl(); this.statusStrip1 = new System.Windows.Forms.StatusStrip(); 82 this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel(); this.axToolbarControl2 = new ESRI.ArcGIS.Controls.AxToolbarControl(); this.label2 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label(); ((System.ComponentModel.ISupportInitialize)(this.axMapControl1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.axTOCControl)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.axLicenseControl1)).BeginInit() this.panel1.SuspendLayout(); this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout(); this.splitContainer1.SuspendLayout(); this.tabControl1.SuspendLayout(); this.tabPage1.SuspendLayout(); this.tabPage2.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.axToolbarControl1)).BeginInit( ); this.statusStrip1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.axToolbarControl2)).BeginInit( ); this.SuspendLayout(); // // axMapControl1 // this.axMapControl1.Dock = System.Windows.Forms.DockStyle.Fill; this.axMapControl1.Location = new System.Drawing.Point(0, 28); this.axMapControl1.Name = "axMapControl1"; this.axMapControl1.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axMapControl1.Oc xState"))); this.axMapControl1.Size = new System.Drawing.Size(666, 569); this.axMapControl1.TabIndex = 0; // // axTOCControl // this.axTOCControl.Dock = System.Windows.Forms.DockStyle.Fill; this.axTOCControl.Location = new System.Drawing.Point(3, 3); this.axTOCControl.Name = "axTOCControl"; this.axTOCControl.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axTOCControl.Ocx State"))); 83 this.axTOCControl.Size = new System.Drawing.Size(258, 565); this.axTOCControl.TabIndex = 49; // // label4 // this.label4.AutoSize = true; this.label4.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label4.Location = new System.Drawing.Point(227, 9); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(63, 16); this.label4.TabIndex = 51; this.label4.Text = "Tiêu chí"; // // cboField // this.cboField.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.cboField.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.cboField.Location = new System.Drawing.Point(296, 5); this.cboField.Name = "cboField"; this.cboField.Size = new System.Drawing.Size(117, 24); this.cboField.TabIndex = 52; // // label5 // this.label5.AutoSize = true; this.label5.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label5.Location = new System.Drawing.Point(11, 9); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(88, 16); this.label5.TabIndex = 53; this.label5.Text = "Lớp liệu:"; // // cboLayer // this.cboLayer.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 84 this.cboLayer.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.cboLayer.Location = new System.Drawing.Point(105, 6); this.cboLayer.Name = "cboLayer"; this.cboLayer.Size = new System.Drawing.Size(116, 24); this.cboLayer.TabIndex = 54; this.cboLayer.SelectedIndexChanged += new System.EventHandler(this.cboLayer_SelectedIndexChanged); // // imgView // this.imgView.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imgView.Ima geStream"))); this.imgView.TransparentColor = System.Drawing.Color.Silver; this.imgView.Images.SetKeyName(0, ""); this.imgView.Images.SetKeyName(1, ""); this.imgView.Images.SetKeyName(2, ""); this.imgView.Images.SetKeyName(3, ""); this.imgView.Images.SetKeyName(4, ""); this.imgView.Images.SetKeyName(5, ""); this.imgView.Images.SetKeyName(6, ""); this.imgView.Images.SetKeyName(7, ""); this.imgView.Images.SetKeyName(8, ""); this.imgView.Images.SetKeyName(9, ""); // // btn_OK // this.btn_OK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.T op | System.Windows.Forms.AnchorStyles.Right))); this.btn_OK.BackColor = System.Drawing.SystemColors.ButtonFace; this.btn_OK.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.btn_OK.Location = new System.Drawing.Point(772, 3); this.btn_OK.Name = "btn_OK"; this.btn_OK.Size = new System.Drawing.Size(164, 26); this.btn_OK.TabIndex = 56; this.btn_OK.Text = "Thực phân cụm"; this.btn_OK.UseVisualStyleBackColor = false; this.btn_OK.Click += new System.EventHandler(this.OK_Click); 85 // // axLicenseControl1 // this.axLicenseControl1.Enabled = true; this.axLicenseControl1.Location = new System.Drawing.Point(47, 182); this.axLicenseControl1.Name = "axLicenseControl1"; this.axLicenseControl1.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axLicenseControl1 OcxState"))); this.axLicenseControl1.Size = new System.Drawing.Size(32, 32); this.axLicenseControl1.TabIndex = 57; // // panel1 // this.panel1.Controls.Add(this.txt_Epxilon); this.panel1.Controls.Add(this.txt_Minpt); this.panel1.Controls.Add(this.splitContainer1); this.panel1.Controls.Add(this.btn_OK); this.panel1.Controls.Add(this.axLicenseControl1); this.panel1.Controls.Add(this.cboLayer); this.panel1.Controls.Add(this.cboField); this.panel1.Controls.Add(this.label2); this.panel1.Controls.Add(this.label1); this.panel1.Controls.Add(this.label5); this.panel1.Controls.Add(this.label4); this.panel1.Dock = System.Windows.Forms.DockStyle.Fill; this.panel1.Location = new System.Drawing.Point(0, 0); this.panel1.Name = "panel1"; this.panel1.Size = new System.Drawing.Size(948, 635); this.panel1.TabIndex = 58; // // txt_Epxilon // this.txt_Epxilon.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.txt_Epxilon.Location = new System.Drawing.Point(656, 5); this.txt_Epxilon.Name = "txt_Epxilon"; this.txt_Epxilon.Size = new System.Drawing.Size(100, 22); this.txt_Epxilon.TabIndex = 60; // // txt_Minpt // 86 this.txt_Minpt.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.txt_Minpt.Location = new System.Drawing.Point(478, 5); this.txt_Minpt.Name = "txt_Minpt"; this.txt_Minpt.Size = new System.Drawing.Size(107, 22); this.txt_Minpt.TabIndex = 59; // // splitContainer1 // this.splitContainer1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.splitContainer1.Location = new System.Drawing.Point(3, 35); this.splitContainer1.Name = "splitContainer1"; // // splitContainer1.Panel1 // this.splitContainer1.Panel1.Controls.Add(this.tabControl1); // // splitContainer1.Panel2 // this.splitContainer1.Panel2.Controls.Add(this.axToolbarControl1); this.splitContainer1.Panel2.Controls.Add(this.statusStrip1); this.splitContainer1.Panel2.Controls.Add(this.axMapControl1); this.splitContainer1.Panel2.Controls.Add(this.axToolbarControl2); this.splitContainer1.Size = new System.Drawing.Size(942, 597); this.splitContainer1.SplitterDistance = 272; this.splitContainer1.TabIndex = 58; // // tabControl1 // this.tabControl1.Controls.Add(this.tabPage1); this.tabControl1.Controls.Add(this.tabPage2); this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill; this.tabControl1.Location = new System.Drawing.Point(0, 0); this.tabControl1.Name = "tabControl1"; this.tabControl1.SelectedIndex = 0; this.tabControl1.Size = new System.Drawing.Size(272, 597); this.tabControl1.TabIndex = 50; // 87 // tabPage1 // this.tabPage1.Controls.Add(this.axTOCControl); this.tabPage1.Location = new System.Drawing.Point(4, 22); this.tabPage1.Name = "tabPage1"; this.tabPage1.Padding = new System.Windows.Forms.Padding(3); this.tabPage1.Size = new System.Drawing.Size(264, 571); this.tabPage1.TabIndex = 0; this.tabPage1.Text = "Color"; this.tabPage1.UseVisualStyleBackColor = true; // // tabPage2 // this.tabPage2.Controls.Add(this.dataGridView1); this.tabPage2.Location = new System.Drawing.Point(4, 22); this.tabPage2.Name = "tabPage2"; this.tabPage2.Padding = new System.Windows.Forms.Padding(3); this.tabPage2.Size = new System.Drawing.Size(264, 571); this.tabPage2.TabIndex = 1; this.tabPage2.Text = "Data"; this.tabPage2.UseVisualStyleBackColor = true; // // dataGridView1 // this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dataGridView1.Dock = System.Windows.Forms.DockStyle.Fill; this.dataGridView1.Location = new System.Drawing.Point(3, 3); this.dataGridView1.Name = "dataGridView1"; this.dataGridView1.Size = new System.Drawing.Size(258, 565); this.dataGridView1.TabIndex = 0; // // axToolbarControl1 // this.axToolbarControl1.Dock = System.Windows.Forms.DockStyle.Bottom; this.axToolbarControl1.Location = new System.Drawing.Point(0, 547); this.axToolbarControl1.Name = "axToolbarControl1"; this.axToolbarControl1.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axToolbarControl1 OcxState"))); this.axToolbarControl1.Size = new System.Drawing.Size(666, 28); this.axToolbarControl1.TabIndex = 59; // 88 // statusStrip1 // this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.toolStripStatusLabel1}); this.statusStrip1.Location = new System.Drawing.Point(0, 575); this.statusStrip1.Name = "statusStrip1"; this.statusStrip1.Size = new System.Drawing.Size(666, 22); this.statusStrip1.TabIndex = 60; this.statusStrip1.Text = "statusStrip1"; // // toolStripStatusLabel1 // this.toolStripStatusLabel1.Name = "toolStripStatusLabel1"; this.toolStripStatusLabel1.Size = new System.Drawing.Size(394, 17); this.toolStripStatusLabel1.Text = "Nguyễn Thị Huế - Trường Đại học Công nghệ - Đại học Quốc gia Hà Nội"; // // axToolbarControl2 // this.axToolbarControl2.Dock = System.Windows.Forms.DockStyle.Top; this.axToolbarControl2.Location = new System.Drawing.Point(0, 0); this.axToolbarControl2.Name = "axToolbarControl2"; this.axToolbarControl2.OcxState= ((System.Windows.Forms.AxHost.State)(resources.GetObject("axToolbarControl2 OcxState"))); this.axToolbarControl2.Size = new System.Drawing.Size(666, 28); this.axToolbarControl2.TabIndex = 61; // // label2 // this.label2.AutoSize = true; this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label2.Location = new System.Drawing.Point(591, 9); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(59, 16); this.label2.TabIndex = 53; this.label2.Text = "Epxilon"; // // label1 // this.label1.AutoSize = true; 89 this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label1.Location = new System.Drawing.Point(419, 8); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(53, 16); this.label1.TabIndex = 53; this.label1.Text = "Minpts"; // // Form1 // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.ClientSize = new System.Drawing.Size(948, 635); this.Controls.Add(this.panel1); this.Name = "Form1"; this.ShowIcon = false; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "Phân cụm liệu thuật toán DBScan"; this.Load += new System.EventHandler(this.Form1_Load); this.Closing += new System.ComponentModel.CancelEventHandler(this.Form1_Closing); ((System.ComponentModel.ISupportInitialize)(this.axMapControl1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.axTOCControl)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.axLicenseControl1)).EndInit(); this.panel1.ResumeLayout(false); this.panel1.PerformLayout(); this.splitContainer1.Panel1.ResumeLayout(false); this.splitContainer1.Panel2.ResumeLayout(false); this.splitContainer1.Panel2.PerformLayout(); this.splitContainer1.ResumeLayout(false); this.tabControl1.ResumeLayout(false); this.tabPage1.ResumeLayout(false); this.tabPage2.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.axToolbarControl1)).EndInit(); this.statusStrip1.ResumeLayout(false); this.statusStrip1.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.axToolbarControl2)).EndInit(); this.ResumeLayout(false); } #endregion [STAThread] static void Main() 90 { Application.Run(new Form1()); } private IRgbColor GetRGBColor(int yourRed, int yourGreen, int yourBlue) { IRgbColor pRGB=new RgbColorClass(); pRGB.Red = yourRed; pRGB.Green = yourGreen; pRGB.Blue = yourBlue; pRGB.UseWindowsDithering = true; return pRGB; } /// /// Checkout the Licence of ArcEngine /// /// public bool CheckLicence() { m_AoInitialize = new AoInitializeClass(); //Determine if the product is available esriLicenseStatus licenseStatus = (esriLicenseStatus)m_AoInitialize.IsProductCodeAvailable(esriLicenseProductCod e.esriLicenseProductCodeEngine); if (licenseStatus == esriLicenseStatus.esriLicenseAvailable) { licenseStatus = (esriLicenseStatus)m_AoInitialize.Initialize(esriLicenseProductCode.esriLicensePr oductCodeEngine); if (licenseStatus != esriLicenseStatus.esriLicenseCheckedOut) { MessageBox.Show("License ArcEngine không hợp lệ nên chương trình khơng thể chạy được!","Thơng báo", MessageBoxButtons.OK,MessageBoxIcon.Exclamation); return false; } return true; } else { return true; } 91 } public void ShutDownESRI() { AOUninitialize.Shutdown(); m_AoInitialize.Shutdown(); } private void Form1_Load(object sender, System.EventArgs e) { if(CheckLicence()) { idx = 0; fPath = Application.StartupPath + "\\SDE_Blank.mdb"; OpenMDBFile(fPath); Load_Combobox(); conn = new OleDbConnection(Constr); } } private void Form1_Closing(object sender, System.ComponentModel.CancelEventArgs e) { ShutDownESRI(); } #region Arcgis, Database MDB private void Load_Combobox() { //Lớp cboLayer.Items.Add("Tỉnh"); cboLayer.Items.Add("Huyện"); cboLayer.Items.Add("Xã"); cboLayer.SelectedIndex = 0; //Tiêu chí phân cụm cboField.Items.Add("Diện tích"); cboField.Items.Add("Chu vi"); cboField.SelectedIndex = 0; } IWorkspaceFactory workspaceFactory; IFeatureWorkspace pFeatureWorkspace; private void OpenMDBFile(string filemdb) { //Mở MDB file workspaceFactory = new ESRI.ArcGIS.DataSourcesGDB.AccessWorkspaceFactoryClass(); 92 pFeatureWorkspace = (IFeatureWorkspace)workspaceFactory.OpenFromFile(filemdb, 0); return; } private void AddLayer(string tblName, string dispName, string clmName) { //Thêm lớp IFeatureClass pFeatureClass = pFeatureWorkspace.OpenFeatureClass(tblName); IFeatureLayer pFeaturelayer = new FeatureLayerClass(); m_pGeoFeatureLayer =(IGeoFeatureLayer) pFeaturelayer; pFeaturelayer.FeatureClass = pFeatureClass; pFeaturelayer.Name = dispName;// pFeatureClass.AliasName; To_Mau(clmName); axMapControl1.AddLayer((ILayer)pFeaturelayer, 0); axMapControl1.Refresh(); return ; } public void ClearLayer() { axMapControl1.ClearLayers(); axMapControl1.Refresh(); } int idx; string fPath = null; string fTableName = null; string fFieldName = null; String Constr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Application.StartupPath + "\\SDE_Blank.mdb"; OleDbConnection conn; OleDbCommand comm; private void To_Mau(string sfieldname) { string fieldname = sfieldname; IUniqueValueRenderer pUniqueValueRenderer; IFillSymbol pSym; IColor pColor; IColor pNextUniqueColor; IEnumColors pEnumRamp; ITable pTable; int fieldNumber; IRow pNextRow; IRowBuffer pNextRowBuffer; 93 ICursor pCursor; IQueryFilter pQueryFilter; object codeValue; pUniqueValueRenderer = new UniqueValueRendererClass(); pTable = (ITable)m_pGeoFeatureLayer; fieldNumber = pTable.FindField(fieldname); if (fieldNumber == -1) MessageBox.Show("Can't find field called " + fieldname); pUniqueValueRenderer.FieldCount = 1; pUniqueValueRenderer.set_Field(0, fieldname); IRandomColorRamp pColorRamp = new RandomColorRampClass(); pColorRamp.StartHue = 0; pColorRamp.MinValue = 99; pColorRamp.MinSaturation = 15; pColorRamp.EndHue = 360; pColorRamp.MaxValue = 100; pColorRamp.MaxSaturation = 30; pColorRamp.Size = 100; bool t = true; pColorRamp.CreateRamp(out t); pEnumRamp = pColorRamp.Colors; pNextUniqueColor = null; pQueryFilter = new QueryFilterClass(); pQueryFilter.AddField(fieldname); pCursor = pTable.Search(pQueryFilter, true); pNextRow = pCursor.NextRow(); while (pNextRow != null) { pNextRowBuffer = pNextRow; codeValue = pNextRowBuffer.get_Value(pNextRowBuffer.Fields.FindField(fieldname)); pNextUniqueColor = pEnumRamp.Next(); if (pNextUniqueColor == null) { pEnumRamp.Reset(); pNextUniqueColor = pEnumRamp.Next(); } pSym = new SimpleFillSymbol(); pSym.Color = pNextUniqueColor; pUniqueValueRenderer.AddValue(codeValue.ToString(), fieldname, (ISymbol)pSym); pNextRow = pCursor.NextRow(); } 94 pSym = new SimpleFillSymbol(); pSym.Color = pEnumRamp.Next(); pUniqueValueRenderer.DefaultSymbol = (ISymbol)pSym; m_pGeoFeatureLayer.Renderer = (IFeatureRenderer)pUniqueValueRenderer; axMapControl1.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeograph y, null, null); return; } private void Update_DB() { clsData _dbscanData = new clsData(Application.StartupPath + @"\SDE_Blank.mdb"); DataSet ds = new DataSet(); ds = _dbscanData.Get_Data(fTableName, fFieldName); DBScanProject.clsDBScan _dbscanProject = new DBScanProject.clsDBScan(ds); int _min = 0; double _epx = 0; try { _min = Convert.ToInt16(txt_Minpt.Text); _epx = Convert.ToDouble(txt_Epxilon.Text); } catch { } _dbscanProject.DBCluster(_min,_epx); _dbscanProject.Get_Result(); ds = _dbscanProject.Get_Dataset(ds); _dbscanData.Set_Cluster(ds, fTableName); try { dataGridView1.DataSource = _dbscanData.LoadDB_Cluster(fTableName).Tables[0]; } catch { dataGridView1.DataSource = null; } } #endregion private void OK_Click(object sender, EventArgs e) { this.axMapControl1.ClearLayers(); 95 dataGridView1.DataSource = null; switch (cboLayer.SelectedIndex) { case 0: { fTableName = "RGTINH"; break; } case 1: { fTableName = "RGHUYEN"; break; } case 2: { fTableName = "RGXA"; break; } } switch (cboField.SelectedIndex) { case 0: { fFieldName = "SHAPE_Area"; break; } case 1: { fFieldName = "SHAPE_Length"; break; } } Update_DB(); idx++; AddLayer(fTableName, "Lớp " + idx.ToString(), "cluster"); } } } ... với ứng dụng khác người sử dụng phải lựa chọn thuật toán phân cụm cụ thể thích ứng với ứng dụng Kết đánh giá cho thuật toán phụ thuộc vào yêu cầu ứng dụng 2.2 Các ứng dụng phân cụm Phân cụm liệu. .. phá liệu; qui trình khai phá tri thức, khai phá liệu; … Chương 2: Phân cụm kỹ thuật phân cụm Trong chương trình bày tổng quan phân cụm liệu, số phương pháp phân cụm liệu liệu phổ biến phân cụm phân. .. DỮ LIỆU VÀ CÁC THUẬT TOÁN TRONG PHÂN CỤM DỮ LIỆU 2.1 Giới thiệu Phân cụm q trình nhóm điểm liệu sở liệu thành cụm cho điểm liệu cụm có độ tương đồng lớn điểm khơng cụm có tương đồng nhỏ Một cụm

Ngày đăng: 05/12/2020, 11:23

Từ khóa liên quan

Mục lục

  • MỤC LỤC

  • DANH MỤC CÁC KÝ HIỆU, TỪ VIẾT TẮT

  • DANH MỤC HÌNH VẼ

  • MỞ ĐẦU

  • 1.1. Giới thiệu chung

  • 1.2. Khai phá tri thức và quá trình khai phá tri thức

  • 1.2.1. Khai phá tri thức

  • 1.2.2. Quá trình khai phá tri thức

  • 1.3. Khai phá dữ liệu

  • 1.3.1. Khai phá dữ liệu

  • 1.3.2. Mục tiêu của khai phá dữ liệu

  • 1.3.3. Quá trình khai phá dữ liệu

  • 1.3.4. Các hướng tiếp cận cơ bản và kỹ thuật áp dụng trong khai phá dữ liệu

  • 1.3.5. Thách thức – khó khăn trong khai phá tri thức và khai phá dữ liệu

  • 1.3.6. Ứng dụng của khai phá dữ liệu

  • 1.3.7. Kết luận

  • Chương 2. PHÂN CỤM DỮ LIỆU VÀ CÁC THUẬT TOÁN TRONG PHÂN CỤM DỮ LIỆU

  • 2.1. Giới thiệu

  • 2.2. Các ứng dụng của phân cụm

  • 2.3. Các yêu cầu về thuật toán phân cụm dữ liệu

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

Tài liệu liên quan