Example #1
0
        public string writeModel(string outModelPath)
        {
            outPath = outModelPath;
            string outPathSvm = outModelPath.Replace(".mdl", ".svm");

            svmMachine.Save(outPathSvm);
            using (System.IO.StreamWriter sw = new System.IO.StreamWriter(outPath))
            {
                sw.WriteLine(modelTypes.SVM.ToString());
                sw.WriteLine(InTablePath);
                sw.WriteLine(String.Join(",", IndependentFieldNames));
                sw.WriteLine(String.Join(",", DependentFieldNames));
                if (ClassFieldNames != null)
                {
                    sw.WriteLine(String.Join(",", ClassFieldNames));
                }
                else
                {
                    sw.WriteLine();
                }
                sw.WriteLine(SampleSize.ToString());
                sw.WriteLine(NumberOfVariables.ToString());
                sw.WriteLine(sserror.ToString());
                sw.WriteLine(kTyp.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()));
                sw.Close();
            }
            return(outPath);
        }
Example #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();
 }
Example #3
0
 public string writeModel(string outModelPath)
 {
     outPath = outModelPath;
     using (System.IO.StreamWriter sw = new System.IO.StreamWriter(outPath))
     {
         sw.WriteLine(modelTypes.LinearRegression.ToString());
         sw.WriteLine(InTablePath);
         sw.WriteLine(String.Join(",", IndependentFieldNames));
         sw.WriteLine(String.Join(",", DependentFieldNames));
         sw.WriteLine(String.Join(",", ClassFieldNames));
         sw.WriteLine(SampleSize.ToString());
         sw.WriteLine(NumberOfVariables.ToString());
         sw.WriteLine(InterceptThroughOrigin.ToString());
         sw.WriteLine(RMSE);
         sw.WriteLine(FValue.ToString());
         sw.WriteLine(PValue.ToString());
         sw.WriteLine(Rsquared.ToString());
         sw.WriteLine(AdjustedRsquared.ToString());
         sw.WriteLine(String.Join(" ", (from double d in Coefficients select d.ToString()).ToArray()));
         sw.WriteLine(String.Join(" ", (from double d in StandardErrors select d.ToString()).ToArray()));
         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()));
         sw.Close();
     }
     return(outPath);
 }
Example #4
0
 public void getReport(double alpha)
 {
     Forms.RunningProcess.frmRunningProcessDialog rd = new Forms.RunningProcess.frmRunningProcessDialog(false);
     rd.Text               = "GLM 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("Iteration = " + Iterations.ToString());
     rd.addMessage("Delta Convergence " + DeltaC.ToString());
     rd.addMessage("Chi-Sqr = " + ChiSquare.ToString() + " p-value = " + PValue.ToString());
     rd.addMessage("Deviance = " + Deviance.ToString());
     rd.addMessage("Log Likelihood = " + LogLikelihood.ToString());
     rd.addMessage("Log Likelihood Ratio = " + LogLikelihoodratio.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 StdError select d.ToString()).ToArray()) + "\n");
     try
     {
         if (ModelHelper.chartingAvailable() && System.Windows.Forms.MessageBox.Show("Do you want to build distribution 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 #5
0
 public string writeModel(string outModelPath)
 {
     outPath = outModelPath;
     using (System.IO.StreamWriter sw = new System.IO.StreamWriter(outPath))
     {
         sw.WriteLine(modelTypes.GLM.ToString());
         sw.WriteLine(InTablePath);
         sw.WriteLine(String.Join(",", IndependentFieldNames));
         sw.WriteLine(String.Join(",", DependentFieldNames));
         sw.WriteLine(String.Join(",", ClassFieldNames));
         sw.WriteLine(SampleSize.ToString());
         sw.WriteLine(NumberOfVariables.ToString());
         sw.WriteLine(Iterations.ToString());
         sw.WriteLine(DeltaC.ToString());
         sw.WriteLine(LogLikelihood);
         sw.WriteLine(LogLikelihoodratio);
         sw.WriteLine(PValue.ToString());
         sw.WriteLine(Deviance.ToString());
         sw.WriteLine(ChiSquare.ToString());
         sw.WriteLine(linkfunction.ToString());
         sw.WriteLine(String.Join(" ", (from double d in Coefficients select d.ToString()).ToArray()));
         sw.WriteLine(String.Join(" ", (from double d in StdError select d.ToString()).ToArray()));
         sw.WriteLine(String.Join(" ", (from double d in waldTestValues select d.ToString()).ToArray()));
         sw.WriteLine(String.Join(" ", (from double d in waldTestPValues select d.ToString()).ToArray()));
         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()));
         sw.Close();
     }
     return(outPath);
 }
Example #6
0
 public void getReport()
 {
     Forms.RunningProcess.frmRunningProcessDialog rd = new Forms.RunningProcess.frmRunningProcessDialog(false);
     rd.Text               = "SVM 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("Sum of Squared Error:  " + sserror.ToString());
     rd.Show();
     rd.enableClose();
 }
Example #7
0
 public void getReport()
 {
     Forms.RunningProcess.frmRunningProcessDialog rd = new Forms.RunningProcess.frmRunningProcessDialog(false);
     rd.Text               = "LDA 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("Means:  " + string.Join(", ", (from double d in meanValues select d.ToString()).ToArray()));
     rd.addMessage("Standard Dev:   " + string.Join(", ", (from double d in stdValues select d.ToString()).ToArray()) + "\n");
     rd.Show();
     rd.enableClose();
 }
Example #8
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);
 }
Example #9
0
 public string writeModel(string outModelPath)
 {
     outPath = outModelPath;
     using (System.IO.StreamWriter sw = new System.IO.StreamWriter(outPath))
     {
         sw.WriteLine(modelTypes.LDA.ToString());
         sw.WriteLine(InTablePath);
         sw.WriteLine(String.Join(",", IndependentFieldNames));
         sw.WriteLine(String.Join(",", DependentFieldNames));
         sw.WriteLine(String.Join(",", ClassFieldNames));
         sw.WriteLine(SampleSize.ToString());
         sw.WriteLine(NumberOfVariables.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()));
         sw.WriteLine(String.Join(" ", (from double d in meanValues select d.ToString()).ToArray()));
         sw.WriteLine(String.Join(" ", (from double d in stdValues select d.ToString()).ToArray()));
         sw.Close();
     }
     return(outPath);
 }
        public void WriteXml(XmlWriter writer)
        {
            writer.WriteAttributeString("nominal", Nominal.ToString(CultureInfo.InvariantCulture));
            writer.WriteAttributeString("mean", Mean.ToString(CultureInfo.InvariantCulture));
            writer.WriteAttributeString("standardDeviation", StandardDeviation.ToString(CultureInfo.InvariantCulture));
            writer.WriteAttributeString("lowerSpecLimit", LowerSpecLimit.ToString(CultureInfo.InvariantCulture));
            writer.WriteAttributeString("upperSpecLimit", UpperSpecLimit.ToString(CultureInfo.InvariantCulture));
            writer.WriteAttributeString("cp", Cp.ToString(CultureInfo.InvariantCulture));
            writer.WriteAttributeString("cpk", Cpk.ToString(CultureInfo.InvariantCulture));
            writer.WriteAttributeString("distribution", Distribution);
            writer.WriteAttributeString("skewness", Skewness.ToString(CultureInfo.InvariantCulture));
            writer.WriteAttributeString("kurtosis", Kurtosis.ToString(CultureInfo.InvariantCulture));
            writer.WriteAttributeString("sampleSize", SampleSize.ToString(CultureInfo.InvariantCulture));

            writer.WriteStartElement("Sample");
            Sample.WriteXml(writer);
            writer.WriteEndElement();

            writer.WriteStartElement("Estimate");
            Estimate.WriteXml(writer);
            writer.WriteEndElement();
        }