private void btnExecute_Click(object sender, EventArgs e) { string smpFtrNm = cmbSampleFeatureClass.Text; string depFld = cmbDepedent.Text; double alpha = System.Convert.ToInt32(nudStay.Value); string outP = txtOutputPath.Text; if (smpFtrNm == null || smpFtrNm == "") { MessageBox.Show("You must select a feature Class", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (depFld == null || depFld == "") { MessageBox.Show("You must select a dependent field", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (outP == null || outP == "") { MessageBox.Show("You must select an output model path", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } List <string> lstInd = new List <string>(); for (int i = 0; i < lstIndependent.Items.Count; i++) { string s = lstIndependent.Items[i].ToString(); lstInd.Add(s); } if (lstInd.Count < 1) { MessageBox.Show("You must select at least one independent field", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (!lstCategoricalFlds.Contains(depFld)) { lstCategoricalFlds.Add(depFld); } this.Visible = false; try { Statistics.ModelHelper.runProgressBar("Running Logistic Regression"); ITable ftrCls = ftrDic[smpFtrNm]; Statistics.dataPrepLogisticRegression plr = new Statistics.dataPrepLogisticRegression(ftrCls, new string[] { depFld }, lstInd.ToArray(), lstCategoricalFlds.ToArray()); plr.writeModel(outP); plr.getReport(alpha); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { Statistics.ModelHelper.closeProgressBar(); this.Close(); } }
private void btnExecute_Click(object sender, EventArgs e) { string smpFtrNm = cmbSampleFeatureClass.Text; string depFld = cmbDepedent.Text; double alpha = System.Convert.ToInt32(nudStay.Value); string outP = txtOutputPath.Text; if (smpFtrNm == null || smpFtrNm == "") { MessageBox.Show("You must select a feature Class","Error",MessageBoxButtons.OK,MessageBoxIcon.Error); return; } if (depFld == null || depFld == "") { MessageBox.Show("You must select a dependent field", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (outP == null || outP == "") { MessageBox.Show("You must select an output model path", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } List<string> lstInd = new List<string>(); for (int i = 0; i < lstIndependent.Items.Count; i++) { string s = lstIndependent.Items[i].ToString(); lstInd.Add(s); } if (lstInd.Count < 1) { MessageBox.Show("You must select at least one independent field", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (!lstCategoricalFlds.Contains(depFld)) lstCategoricalFlds.Add(depFld); this.Visible = false; try { Statistics.ModelHelper.runProgressBar("Running Logistic Regression"); ITable ftrCls = ftrDic[smpFtrNm]; Statistics.dataPrepLogisticRegression plr = new Statistics.dataPrepLogisticRegression(ftrCls, new string[] { depFld }, lstInd.ToArray(), lstCategoricalFlds.ToArray()); plr.writeModel(outP); plr.getReport(alpha); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { Statistics.ModelHelper.closeProgressBar(); this.Close(); } }