Example #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();
        }
Example #2
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);
 }