private void buttonXDataDiscretization_Click(object sender, EventArgs e) { int illegalInputCount = 0; BayesObjectTableAdapter bayesObjectTableAdapter = new BayesObjectTableAdapter(); DataSetTempTableAdapter dataSetTempTableAdapter = new DataSetTempTableAdapter(); DataSetTableAdapter dataSetTableAdapter = new DataSetTableAdapter(); for (int i = listIntervalValue.Count - 1; i > 0; i--) { double currentValue = listIntervalValue[i]; double previousValue = listIntervalValue[i - 1]; if (currentValue <= previousValue) { illegalInputCount++; break; } } if (illegalInputCount > 0) { MessageBox.Show("Giá trị của từng khoảng nhập vào không hợp lệ", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { bayesObjectTableAdapter.DeleteByOne(this.ColName); DataTable dtDataSetForPreProcessing = dataSetTableAdapter.GetData(); DiabetesDataSet.DataSetTempDataTable dtDataSetTemp = dataSetTempTableAdapter.GetData(); int rowIndex = 0; foreach (DataRow dtRow in dtDataSetForPreProcessing.Rows) { decimal colValue = Convert.ToDecimal(dtRow[this.ColName]); decimal maBn = Convert.ToDecimal(dtRow["MaBn"]); String discretizationValue = DataDiscretization(colValue, this.listIntervalValue); dtDataSetTemp.Rows[rowIndex][this.ColName] = discretizationValue; rowIndex++; } dataSetTempTableAdapter.Update(dtDataSetTemp); CreateBayesObject(this.ColName, this.listIntervalValue); } this.Close(); }
private void buttonXDiscretizationDataStatistics_Click(object sender, EventArgs e) { if (checkedListBoxColumnName.SelectedIndex == -1) { MessageBox.Show("Chưa chọn thuộc tính để xem thống kê", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { String colName = checkedListBoxColumnName.SelectedItem.ToString(); BayesObjectTableAdapter bayesObjectTableAdapter = new BayesObjectTableAdapter(); DataSetTempTableAdapter dataSetTempTableAdapter = new DataSetTempTableAdapter(); DataTable dtBayesForStatistics = bayesObjectTableAdapter.GetData(); DataTable dtSetTempForStatistics = dataSetTempTableAdapter.GetData(); DataRow[] bayesRows = bayesObjectTableAdapter.GetData().Select("TenThuocTinh='" + colName + "'"); dtBayesForStatistics.Clear(); int iCount = 0; foreach (DataRow bayesRow in bayesRows) { String tenThuocTinh = bayesRow["TenThuocTinh"].ToString(); String khoangRoiRac = bayesRow["KhoangRoiRac"].ToString(); String tieuDuong = bayesRow["TieuDuong"].ToString(); int tongSoLuong = 0; String iQuery = "" + tenThuocTinh + "='" + khoangRoiRac + "' and TieuDuong='" + tieuDuong + "'"; tongSoLuong = dtSetTempForStatistics.Select(iQuery).Count(); DataRow newRow = dtBayesForStatistics.NewRow(); iCount++; newRow[0] = iCount; newRow[1] = tenThuocTinh; newRow[2] = khoangRoiRac; newRow[3] = tongSoLuong; newRow[4] = tieuDuong; dtBayesForStatistics.Rows.Add(newRow); } dataGridViewXDescriptiveData.DataSource = dtBayesForStatistics; dataGridViewXDescriptiveData.Columns["ID"].Visible = true; } }
private void buttonXDataDiscretization_Click(object sender, EventArgs e) { int illegalInputCount = 0; BayesObjectTableAdapter bayesObjectTableAdapter = new BayesObjectTableAdapter(); DataSetTempTableAdapter dataSetTempTableAdapter = new DataSetTempTableAdapter(); DataSetTableAdapter dataSetTableAdapter = new DataSetTableAdapter(); for (int i = listIntervalValue.Count - 1; i > 0; i--) { double currentValue = listIntervalValue[i]; double previousValue = listIntervalValue[i - 1]; if (currentValue <= previousValue) { illegalInputCount++; break; } } if (illegalInputCount > 0) MessageBox.Show("Giá trị của từng khoảng nhập vào không hợp lệ", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); else { bayesObjectTableAdapter.DeleteByOne(this.ColName); DataTable dtDataSetForPreProcessing = dataSetTableAdapter.GetData(); DiabetesDataSet.DataSetTempDataTable dtDataSetTemp = dataSetTempTableAdapter.GetData(); int rowIndex = 0; foreach (DataRow dtRow in dtDataSetForPreProcessing.Rows) { decimal colValue = Convert.ToDecimal(dtRow[this.ColName]); decimal maBn = Convert.ToDecimal(dtRow["MaBn"]); String discretizationValue = DataDiscretization(colValue, this.listIntervalValue); dtDataSetTemp.Rows[rowIndex][this.ColName] = discretizationValue; rowIndex++; } dataSetTempTableAdapter.Update(dtDataSetTemp); CreateBayesObject(this.ColName, this.listIntervalValue); } this.Close(); }
private void buttonXDiscretizationDataStatistics_Click(object sender, EventArgs e) { if (checkedListBoxColumnName.SelectedIndex == -1) MessageBox.Show("Chưa chọn thuộc tính để xem thống kê", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); else { String colName = checkedListBoxColumnName.SelectedItem.ToString(); BayesObjectTableAdapter bayesObjectTableAdapter = new BayesObjectTableAdapter(); DataSetTempTableAdapter dataSetTempTableAdapter = new DataSetTempTableAdapter(); DataTable dtBayesForStatistics = bayesObjectTableAdapter.GetData(); DataTable dtSetTempForStatistics = dataSetTempTableAdapter.GetData(); DataRow[] bayesRows = bayesObjectTableAdapter.GetData().Select("TenThuocTinh='" + colName + "'"); dtBayesForStatistics.Clear(); int iCount = 0; foreach (DataRow bayesRow in bayesRows) { String tenThuocTinh = bayesRow["TenThuocTinh"].ToString(); String khoangRoiRac = bayesRow["KhoangRoiRac"].ToString(); String tieuDuong = bayesRow["TieuDuong"].ToString(); int tongSoLuong = 0; String iQuery = "" + tenThuocTinh + "='" + khoangRoiRac + "' and TieuDuong='" + tieuDuong + "'"; tongSoLuong = dtSetTempForStatistics.Select(iQuery).Count(); DataRow newRow = dtBayesForStatistics.NewRow(); iCount++; newRow[0] = iCount; newRow[1] = tenThuocTinh; newRow[2] = khoangRoiRac; newRow[3] = tongSoLuong; newRow[4] = tieuDuong; dtBayesForStatistics.Rows.Add(newRow); } dataGridViewXDescriptiveData.DataSource = dtBayesForStatistics; dataGridViewXDescriptiveData.Columns["ID"].Visible = true; } }