示例#1
0
        public void getReport()
        {
            if (lm == null)
            {
                getMnlModel();
            }
            Forms.RunningProcess.frmRunningProcessDialog rd = new Forms.RunningProcess.frmRunningProcessDialog(false);
            rd.Text               = "Soft Max Nnet Results";
            rd.TopLevel           = true;
            rd.pgbProcess.Visible = false;
            rd.FormBorderStyle    = System.Windows.Forms.FormBorderStyle.Sizable;
            rd.addMessage("Sample size = " + n.ToString());
            rd.addMessage("Number of Classes = " + NumberOfClasses.ToString());
            rd.addMessage("Number of Parameters = " + nvars.ToString());
            rd.addMessage("RMSE = " + RMSE.ToString());
            rd.addMessage("Average Error = " + AverageError.ToString());
            rd.addMessage("Average Relative Error = " + AverageRelativeError.ToString());
            rd.addMessage("Average Cross Entropy Error = " + AverageCrossEntropyError.ToString());
            rd.addMessage("Classification Error = " + ClassificationError.ToString());
            rd.addMessage("Relative Classification Error = " + RelativeClassificationError.ToString());

            try
            {
                if (ModelHelper.chartingAvailable() && System.Windows.Forms.MessageBox.Show("Do you want to build probability graphs?", "Graphs", System.Windows.Forms.MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
                {
                    createRegChart();
                }
            }
            catch
            {
                System.Windows.Forms.MessageBox.Show("Cannot create charts");
            }
            rd.Show();
            rd.enableClose();
        }
示例#2
0
 public void getReport(double alpha)
 {
     Forms.RunningProcess.frmRunningProcessDialog rd = new Forms.RunningProcess.frmRunningProcessDialog(false);
     rd.Text               = "Regression Results";
     rd.TopLevel           = true;
     rd.pgbProcess.Visible = false;
     rd.FormBorderStyle    = System.Windows.Forms.FormBorderStyle.Sizable;
     rd.addMessage("Dependent field = " + DependentFieldNames[0]);
     rd.addMessage("Independent fields = " + String.Join(", ", IndependentFieldNames));
     rd.addMessage("Sample size = " + SampleSize.ToString());
     rd.addMessage("Intercept Through Origin = " + InterceptThroughOrigin.ToString());
     rd.addMessage("F-statistic = " + FValue.ToString() + " p-value = " + PValue.ToString());
     rd.addMessage("RMSE = " + RMSE.ToString());
     rd.addMessage("R2 = " + Rsquared.ToString());
     rd.addMessage("Adj-R2 = " + AdjustedRsquared.ToString() + "\n\nCoefficents and standard errors:\n");
     rd.addMessage("Param: Intercept, " + String.Join(", ", IndependentFieldNames));
     rd.addMessage("Coef:  " + string.Join(", ", (from double d in Coefficients select d.ToString()).ToArray()));
     rd.addMessage("STE:   " + string.Join(", ", (from double d in StandardErrors select d.ToString()).ToArray()) + "\n");
     try
     {
         if (ModelHelper.chartingAvailable())
         {
             regChart();
         }
     }
     catch
     {
         System.Windows.Forms.MessageBox.Show("Cannot create charts");
     }
     rd.Show();
     rd.enableClose();
 }
示例#3
0
 public string writeModel(string outModelPath)
 {
     if (lm == null)
     {
         getMnlModel();
     }
     outPath        = outModelPath;
     double[,] coef = null;
     alglib.mnlunpack(lm, out coef, out nvars, out nclasses);
     using (System.IO.StreamWriter sw = new System.IO.StreamWriter(outPath))
     {
         sw.WriteLine(modelTypes.SoftMax.ToString());
         sw.WriteLine(InTablePath);
         sw.WriteLine(SampleSize.ToString());
         sw.WriteLine(String.Join(",", IndependentFieldNames));
         sw.WriteLine(String.Join(",", DependentFieldNames));
         sw.WriteLine(String.Join(",", ClassFieldNames));
         sw.WriteLine(string.Join(",", Categories));
         sw.WriteLine(NumberOfVariables.ToString());
         sw.WriteLine(NumberOfClasses.ToString());
         sw.WriteLine(RMSE.ToString());
         sw.WriteLine(AverageCrossEntropyError.ToString());
         sw.WriteLine(AverageError.ToString());
         sw.WriteLine(AverageRelativeError.ToString());
         sw.WriteLine(ClassificationError.ToString());
         sw.WriteLine(RelativeClassificationError.ToString());
         sw.WriteLine(String.Join(",", (from double d in minValues select d.ToString()).ToArray()));
         sw.WriteLine(String.Join(",", (from double d in maxValues select d.ToString()).ToArray()));
         sw.WriteLine(String.Join(",", (from double d in sumValues select d.ToString()).ToArray()));
         int rws  = coef.GetUpperBound(1);
         int clms = coef.GetUpperBound(0);
         for (int r = 0; r <= rws; r++)
         {
             string[] ln = new string[clms + 1];
             for (int c = 0; c <= clms; c++)
             {
                 ln[c] = coef[c, r].ToString();
             }
             sw.WriteLine(String.Join(" ", ln));
         }
         sw.Close();
     }
     return(outPath);
 }