Ejemplo n.º 1
0
 public void getReport()
 {
     Forms.RunningProcess.frmRunningProcessDialog rd = new Forms.RunningProcess.frmRunningProcessDialog(false);
     rd.Text               = "PCA Results";
     rd.TopLevel           = true;
     rd.pgbProcess.Visible = false;
     rd.FormBorderStyle    = System.Windows.Forms.FormBorderStyle.Sizable;
     rd.addMessage("Sample size = " + n.ToString());
     rd.addMessage("Vars:  " + String.Join(", ", VariableFieldNames));
     rd.addMessage("\nProportions:  " + String.Join(", ", (from double d in ProportionOfTotalVariance select d.ToString()).ToArray()));
     rd.addMessage("\nEigenValues: " + String.Join(", ", (from double d in EigenValues select d.ToString()).ToArray()));
     rd.addMessage("\n\nEigenvectors:\n");
     double[,] scov = EigenVectors;
     for (int i = 0; i < VariableFieldNames.Length; i++)
     {
         string[] vlArr = new string[VariableFieldNames.Length];
         for (int j = 0; j < VariableFieldNames.Length; j++)
         {
             vlArr[j] = scov[j, i].ToString();
         }
         rd.addMessage(String.Join(", ", vlArr));
     }
     rd.enableClose();
     rd.Show();
 }
Ejemplo n.º 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();
 }
Ejemplo n.º 3
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();
 }
Ejemplo n.º 4
0
 public void getReport(double alpha)
 {
     Forms.RunningProcess.frmRunningProcessDialog rd = new Forms.RunningProcess.frmRunningProcessDialog(false);
     rd.Text               = "Logistic Regression Results";
     rd.TopLevel           = true;
     rd.pgbProcess.Visible = false;
     rd.FormBorderStyle    = System.Windows.Forms.FormBorderStyle.Sizable;
     rd.addMessage("LogLikelihood = " + LogLikelihood.ToString());
     rd.addMessage("Deviance = " + Deviance.ToString());
     rd.addMessage("Likelihood Ratio Chi-squared = " + X2.ToString() + " DF = " + DegreesOfFredom.ToString() + " p-value = " + PValue.ToString());
     rd.addMessage("\n\nClasses: " + String.Join(", ", Categories));
     rd.addMessage("Reference Class = " + Categories[0]);
     rd.addMessage("\nParameter coefficients:\n");
     rd.addMessage("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 StandardError select d.ToString()).ToArray()));
     rd.addMessage("\n\nWald stats for coefficients:\nchi-sq: " + String.Join(", ", (from Accord.Statistics.Testing.WaldTest d in WaldStatistic select d.Statistic.ToString()).ToArray()));
     rd.addMessage("p-value: " + String.Join(", ", (from Accord.Statistics.Testing.WaldTest d in WaldStatistic select d.PValue.ToString()).ToArray()));
     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();
 }
Ejemplo n.º 5
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();
        }
Ejemplo n.º 6
0
 public zonalHelper()
 {
     rsUtil     = new rasterUtil();
     tempWksStr = rsUtil.TempConvDir;
     rd         = new Forms.RunningProcess.frmRunningProcessDialog(false);
     rd.TopMost = true;
     rd.Show();
 }
 public static void getReport(string modelPath,double proportion=0.1,double alpha=0.05)
 {
     esriUtil.Forms.RunningProcess.frmRunningProcessDialog rp = new Forms.RunningProcess.frmRunningProcessDialog(false);
     rp.addMessage("Sample size for " + modelPath + " based on variation");
     rp.stepPGBar(50);
     rp.Show();
     dataPrepBase.modelTypes mType = ModelHelper.getModelType(modelPath);
     rp.addMessage("Model Type = " + mType.ToString());
     try
     {
         switch (mType)
         {
             case dataPrepBase.modelTypes.Accuracy:
                 fillAaReport(modelPath, rp, proportion, alpha);
                 break;
             case dataPrepBase.modelTypes.LinearRegression:
                 fillLrReport(modelPath, rp, proportion, alpha);
                 break;
             case dataPrepBase.modelTypes.MvlRegression:
                 fillMvrReport(modelPath, rp, proportion, alpha);
                 break;
             case dataPrepBase.modelTypes.LogisticRegression:
                 fillLogisticReport(modelPath, rp, proportion, alpha);
                 break;
             case dataPrepBase.modelTypes.PLR:
                 fillPlrReport(modelPath, rp, proportion, alpha);
                 break;
             case dataPrepBase.modelTypes.CovCorr:
                 fillCovCorr(modelPath, rp, proportion, alpha);
                 break;
             case dataPrepBase.modelTypes.PCA:
                 fillPcaReport(modelPath, rp, proportion, alpha);
                 break;
             case dataPrepBase.modelTypes.Cluster:
                 fillCluserReport(modelPath, rp, proportion, alpha);
                 break;
             case dataPrepBase.modelTypes.StrataCovCorr:
                 fillStrataReport(modelPath, rp, proportion, alpha);
                 break;
             default:
                 rp.addMessage("Can't estimate sample size for this type of model!");
                 break;
         }
     }
     catch (Exception e)
     {
         rp.addMessage(e.ToString());
     }
     finally
     {
         rp.stepPGBar(100);
         rp.enableClose();
     }
 }
Ejemplo n.º 8
0
 public void getReport(double alpha)
 {
     Forms.RunningProcess.frmRunningProcessDialog rd = new Forms.RunningProcess.frmRunningProcessDialog(false);
     rd.Text               = "PLR Results";
     rd.TopLevel           = true;
     rd.pgbProcess.Visible = false;
     rd.FormBorderStyle    = System.Windows.Forms.FormBorderStyle.Sizable;
     rd.addMessage("Iterations = " + NumberOfIterationsToConverge.ToString());
     rd.addMessage("Convergence = " + Delta.ToString());
     rd.addMessage("LogLikelihood = " + LogLikelihood.ToString());
     rd.addMessage("Deviance = " + Deviance.ToString());
     rd.addMessage("Likelihood Ratio Chi-squared = " + X2.ToString() + " DF = " + DegreesOfFredom.ToString() + " p-value = " + PValue.ToString());
     rd.addMessage("\n\nClasses: " + String.Join(", ", Categories));
     rd.addMessage("Reference Class = " + Categories[0]);
     rd.addMessage("\nParameter coefficients:\n");
     rd.addMessage("intercept, " + String.Join(", ", IndependentFieldNames));
     for (int i = 0; i < Coefficients.Length; i++)
     {
         double[] c = Coefficients[i];
         rd.addMessage(String.Join(" ", (from double d in c select d.ToString()).ToArray()));
     }
     rd.addMessage("\nParameter standard error:");
     for (int i = 0; i < StandardError.Length; i++)
     {
         double[] c = StandardError[i];
         rd.addMessage(String.Join(", ", (from double d in c select d.ToString()).ToArray()));
     }
     rd.addMessage("\nParameter Wald Chi-Squared:");
     for (int i = 0; i < WaldStatistic.Length; i++)
     {
         double[] c = WaldStatistic[i];
         rd.addMessage(String.Join(", ", (from double d in c select d.ToString()).ToArray()));
     }
     rd.addMessage("\nParameter Wald P-value:");
     for (int i = 0; i < WaldPvalue.Length; i++)
     {
         double[] c = WaldPvalue[i];
         rd.addMessage(String.Join(", ", (from double d in c select d.ToString()).ToArray()));
     }
     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)
         {
             regChart();
             //if (mlr == null) mlr = buildModel();
         }
     }
     catch
     {
         System.Windows.Forms.MessageBox.Show("Cannot create charts");
     }
     rd.Show();
     rd.enableClose();
 }
Ejemplo n.º 9
0
        public void getReport()
        {
            if (mctable == null)
            {
                buildModel();
            }
            Forms.RunningProcess.frmRunningProcessDialog rd = new Forms.RunningProcess.frmRunningProcessDialog(false);
            rd.Text               = "Compare Classifications";
            rd.TopLevel           = true;
            rd.pgbProcess.Visible = false;
            rd.FormBorderStyle    = System.Windows.Forms.FormBorderStyle.Sizable;
            rd.addMessage("Match Paired Comparisons");
            string l00 = mctable[0, 0].ToString();
            string l01 = mctable[0, 1].ToString();
            string l10 = mctable[1, 0].ToString();
            string l11 = mctable[1, 1].ToString();

            rd.addMessage("-".PadRight(100, '-') + "\n");
            string mhd = "          Correct   Wrong";

            rd.addMessage(mhd);
            rd.addMessage("-".PadRight(28, '-'));
            rd.addMessage("Correct | " + adjustString(l00, 7) + " | " + adjustString(l10, 7) + " |");
            rd.addMessage("-".PadRight(28, '-'));
            rd.addMessage("Wrong   | " + adjustString(l01, 7) + " | " + adjustString(l11, 7) + " |");
            rd.addMessage("-".PadRight(28, '-'));
            rd.addMessage("McNemar's test for correct values = " + mct.Statistic.ToString() + " DF = " + mct.DegreesOfFreedom.ToString() + " p-value = " + mct.PValue.ToString());
            rd.addMessage("-".PadRight(100, '-') + "\n");
            rd.addMessage("Kappa comparison of two samples = " + akt.Statistic.ToString() + " DF = 1 p-value = " + akt.PValue.ToString());
            rd.addMessage("-".PadRight(100, '-') + "\n");
            string[] hdArr = (from s in labels select adjustString(s, 5)).ToArray();
            string   hd    = "      | " + String.Join(" | ", hdArr);

            rd.addMessage(hd);
            rd.addMessage("-".PadRight(hd.Length, '-'));
            for (int i = 0; i < hdArr.Length; i++)
            {
                string lnStr = hdArr[i] + " | ";
                for (int j = 0; j < hdArr.Length; j++)
                {
                    lnStr = lnStr + adjustString(g3table[j, i].ToString(), 5) + " | ";
                }
                rd.addMessage(lnStr);
                rd.addMessage("-".PadRight(hd.Length, '-'));
            }
            rd.addMessage("Bhapkar's test of homogeneity = " + bht.Statistic.ToString() + " DF = " + bht.DegreesOfFreedom.ToString() + " p-value = " + bht.PValue.ToString());
            rd.addMessage("Bowker's test of symmetry = " + bkt.Statistic.ToString() + " DF = " + bkt.DegreesOfFreedom.ToString() + " p-value = " + bkt.PValue.ToString());
            rd.Show();
            rd.enableClose();
        }
Ejemplo n.º 10
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();
 }
Ejemplo n.º 11
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();
 }
Ejemplo n.º 12
0
        public void getReport()
        {
            Forms.RunningProcess.frmRunningProcessDialog rd = new Forms.RunningProcess.frmRunningProcessDialog(false);
            rd.Text               = "Kolmogorov Smirnov Two sample distribution Results (p-value for unequal distributions)";
            rd.TopLevel           = true;
            rd.pgbProcess.Visible = false;
            rd.FormBorderStyle    = System.Windows.Forms.FormBorderStyle.Sizable;
            rd.addMessage("Vars:  " + String.Join(", ", Variables));
            rd.addMessage("Perform PCA " + Oridinate.ToString());
            rd.addMessage("Strata Field = " + StrataField);
            rd.addMessage("\n Label   | Statistic  | WP value   | WS p-value");
            rd.addMessage("-".PadRight(48, '-'));
            for (int i = 0; i < Labels.Length; i++)
            {
                string ky   = Labels[i];
                double stat = StatisticValues[i];
                string sVl  = stat.ToString();
                double vl   = PValues[i];
                string fVl  = vl.ToString();
                if (vl < 0.0001)
                {
                    fVl = "p < 0.0001";
                }
                double wVl    = WSpvalues[i];
                string wspStr = wVl.ToString();
                if (wVl < 0.0001)
                {
                    wspStr = "p < 0.0001";
                }
                string l   = ModelHelper.getValue(ky, 8);
                string wp  = ModelHelper.getValue(fVl, 10);
                string s   = ModelHelper.getValue(sVl, 10);
                string wsp = ModelHelper.getValue(wspStr, 10);
                rd.addMessage(l + " | " + s + " | " + wp + " | " + wsp);
            }
            rd.addMessage("-".PadRight(48, '-'));

            if (ModelHelper.chartingAvailable())
            {
                createKSchart();
            }
            rd.enableClose();
            rd.Show();
        }
Ejemplo n.º 13
0
 public void getReport()
 {
     if (kmeans == null)
     {
         buildModel();
     }
     Forms.RunningProcess.frmRunningProcessDialog rd = new Forms.RunningProcess.frmRunningProcessDialog(false);
     rd.Text               = "Stratified Variance Covariance Correlation Results";
     rd.TopLevel           = true;
     rd.pgbProcess.Visible = false;
     rd.FormBorderStyle    = System.Windows.Forms.FormBorderStyle.Sizable;
     rd.addMessage("Input path = " + InPath);
     rd.addMessage("Sample size = " + n.ToString() + " proportion of total records = " + prop.ToString());
     rd.addMessage("Number of Strata = " + k.ToString());
     rd.addMessage("Labels = " + String.Join(", ", lbl.ToArray()));
     rd.addMessage("Variables: " + String.Join(" ,", VariableFieldNames));
     kmeansReport(rd);
     rd.enableClose();
     rd.Show();
 }
Ejemplo n.º 14
0
 public void getReport()
 {
     if (cov == null)
     {
         buildModel();
     }
     Forms.RunningProcess.frmRunningProcessDialog rd = new Forms.RunningProcess.frmRunningProcessDialog(false);
     rd.Text               = "Variance Covariance Results";
     rd.TopLevel           = true;
     rd.pgbProcess.Visible = false;
     rd.FormBorderStyle    = System.Windows.Forms.FormBorderStyle.Sizable;
     rd.addMessage("Sample size = " + n.ToString());
     rd.addMessage("Vars:  " + String.Join(", ", VariableFieldNames));
     rd.addMessage("\nSum:  " + String.Join(", ", (from double d in SumsVector select d.ToString()).ToArray()));
     rd.addMessage("\nMean: " + String.Join(", ", (from double d in MeanVector select d.ToString()).ToArray()));
     rd.addMessage("\n\nSample Variance Covariance:\n");
     double[,] scov = CovarianceMatrix;
     for (int i = 0; i < SumsVector.Length; i++)
     {
         string[] vlArr = new string[SumsVector.Length];
         for (int j = 0; j < SumsVector.Length; j++)
         {
             vlArr[j] = scov[j, i].ToString();
         }
         rd.addMessage(String.Join(", ", vlArr));
     }
     double[,] corr = CorralationMatrix;
     rd.addMessage("\n\nCorr:\n");
     for (int i = 0; i < SumsVector.Length; i++)
     {
         string[] vlArr = new string[SumsVector.Length];
         for (int j = 0; j < SumsVector.Length; j++)
         {
             vlArr[j] = corr[j, i].ToString();
         }
         rd.addMessage(String.Join(", ", vlArr));
     }
     rd.Show();
     rd.enableClose();
 }
Ejemplo n.º 15
0
        public void getReport()
        {
            if (model == null)
            {
                buildModel();
            }
            Forms.RunningProcess.frmRunningProcessDialog rd = new Forms.RunningProcess.frmRunningProcessDialog(false);
            rd.Text               = "Cluster Results";
            rd.TopLevel           = true;
            rd.pgbProcess.Visible = false;
            rd.FormBorderStyle    = System.Windows.Forms.FormBorderStyle.Sizable;
            rd.addMessage("Input path = " + InPath);
            rd.addMessage("Sample size = " + n.ToString() + " proportion of total records = " + prop.ToString());
            rd.addMessage("Number of Cluster = " + k.ToString());
            rd.addMessage("Labels = " + String.Join(", ", lbl.ToArray()));
            rd.addMessage("Variables: " + String.Join(" ,", VariableFieldNames));
            rd.addMessage("Cluster Type: " + cType.ToString());
            switch (cType)
            {
            case clusterType.KMEANS:
                kmeansReport(rd);
                break;

            case clusterType.BINARY:
                binaryReport(rd);
                break;

            case clusterType.GAUSSIANMIXTURE:
                gaussianReport(rd);
                break;

            default:
                break;
            }

            rd.enableClose();
            rd.Show();
        }
Ejemplo n.º 16
0
        public void getReport()
        {
            if (kmeans == null)
            {
                buildModel();
            }
            Forms.RunningProcess.frmRunningProcessDialog rd = new Forms.RunningProcess.frmRunningProcessDialog(false);
            rd.Text               = "Cluster Results";
            rd.TopLevel           = true;
            rd.pgbProcess.Visible = false;
            rd.FormBorderStyle    = System.Windows.Forms.FormBorderStyle.Sizable;
            rd.addMessage("Input path = " + InPath);
            rd.addMessage("Sample size = " + n.ToString() + " proportion of total records = " + prop.ToString());
            rd.addMessage("Number of Cluster = " + k.ToString());
            rd.addMessage("Labels = " + String.Join(", ", lbl.ToArray()));
            rd.addMessage("Variables: " + String.Join(" ,", VariableFieldNames));
            KMeansClusterCollection gCol = kmeans.Clusters;

            for (int i = 0; i < gCol.Count; i++)
            {
                KMeansCluster gClust = gCol[i];
                double[]      mns    = gClust.Mean;
                double[,] cov = gClust.Covariance;
                rd.addMessage("\n\nCluster " + Labels[i] + ":\nMeans: " + String.Join(", ", (from double d in mns select d.ToString()).ToArray()) + "\nCovariance:");
                for (int j = 0; j < VariableFieldNames.Length; j++)
                {
                    string[] covStrArr = new string[VariableFieldNames.Length];
                    for (int l = 0; l < covStrArr.Length; l++)
                    {
                        covStrArr[l] = cov[l, j].ToString();
                    }
                    rd.addMessage("\n" + String.Join(",", covStrArr));
                }
            }
            rd.enableClose();
            rd.Show();
        }
        public void getReport(double alpha)
        {
            Forms.RunningProcess.frmRunningProcessDialog rd = new Forms.RunningProcess.frmRunningProcessDialog(false);
            rd.Text = "Logistic Regression Results";
            rd.TopLevel = true;
            rd.pgbProcess.Visible = false;
            rd.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Sizable;
            rd.addMessage("LogLikelihood = " + LogLikelihood.ToString());
            rd.addMessage("Deviance = " + Deviance.ToString());
            rd.addMessage("Likelihood Ratio Chi-squared = " + X2.ToString() + " DF = " + DegreesOfFredom.ToString() + " p-value = " + PValue.ToString());
            rd.addMessage("\n\nClasses: " + String.Join(", ", Categories));
            rd.addMessage("Reference Class = " + Categories[0]);
            rd.addMessage("\nParameter coefficients:\n");
            rd.addMessage("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 StandardError select d.ToString()).ToArray()));
            rd.addMessage("\n\nWald stats for coefficients:\nchi-sq: "+ String.Join(", ", (from Accord.Statistics.Testing.WaldTest d in WaldStatistic select d.Statistic.ToString()).ToArray()));
            rd.addMessage("p-value: " + String.Join(", ", (from Accord.Statistics.Testing.WaldTest d in WaldStatistic select d.PValue.ToString()).ToArray()));
            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();
        }
 public void getReport()
 {
     Forms.RunningProcess.frmRunningProcessDialog rd = new Forms.RunningProcess.frmRunningProcessDialog(false);
     rd.Text = "PCA Results";
     rd.TopLevel = true;
     rd.pgbProcess.Visible = false;
     rd.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Sizable;
     rd.addMessage("Sample size = " + n.ToString());
     rd.addMessage("Vars:  " + String.Join(", ", VariableFieldNames));
     rd.addMessage("\nProportions:  " + String.Join(", ", (from double d in ProportionOfTotalVariance select d.ToString()).ToArray()));
     rd.addMessage("\nEigenValues: " + String.Join(", ", (from double d in EigenValues select d.ToString()).ToArray()));
     rd.addMessage("\n\nEigenvectors:\n");
     double[,] scov = EigenVectors;
     for (int i = 0; i < VariableFieldNames.Length; i++)
     {
         string[] vlArr = new string[VariableFieldNames.Length];
         for (int j = 0; j < VariableFieldNames.Length; j++)
         {
             vlArr[j] = scov[j, i].ToString();
         }
         rd.addMessage(String.Join(", ", vlArr));
     }
     rd.enableClose();
     rd.Show();
 }
 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();
 }
 public void getReport()
 {
     if (kmeans == null) buildModel();
     Forms.RunningProcess.frmRunningProcessDialog rd = new Forms.RunningProcess.frmRunningProcessDialog(false);
     rd.Text = "Stratified Variance Covariance Correlation Results";
     rd.TopLevel = true;
     rd.pgbProcess.Visible = false;
     rd.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Sizable;
     rd.addMessage("Input path = " + InPath);
     rd.addMessage("Sample size = " + n.ToString() + " proportion of total records = " + prop.ToString());
     rd.addMessage("Number of Strata = " + k.ToString());
     rd.addMessage("Labels = " + String.Join(", ", lbl.ToArray()));
     rd.addMessage("Variables: " + String.Join(" ,", VariableFieldNames));
     kmeansReport(rd);
     rd.enableClose();
     rd.Show();
 }
 public void getReport()
 {
     if(mctable==null)buildModel();
     Forms.RunningProcess.frmRunningProcessDialog rd = new Forms.RunningProcess.frmRunningProcessDialog(false);
     rd.Text = "Compare Classifications";
     rd.TopLevel = true;
     rd.pgbProcess.Visible = false;
     rd.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Sizable;
     rd.addMessage("Match Paired Comparisons");
     string l00 = mctable[0, 0].ToString();
     string l01 = mctable[0, 1].ToString();
     string l10 = mctable[1, 0].ToString();
     string l11 = mctable[1, 1].ToString();
     rd.addMessage("-".PadRight(100, '-') + "\n");
     string mhd =  "          Correct   Wrong";
     rd.addMessage(mhd);
     rd.addMessage("-".PadRight(28, '-'));
     rd.addMessage("Correct | " + adjustString(l00, 7) + " | " + adjustString(l10, 7) + " |");
     rd.addMessage("-".PadRight(28, '-'));
     rd.addMessage("Wrong   | " + adjustString(l01, 7) + " | " + adjustString(l11, 7) + " |");
     rd.addMessage("-".PadRight(28, '-'));
     rd.addMessage("McNemar's test for correct values = " + mct.Statistic.ToString() + " DF = " + mct.DegreesOfFreedom.ToString() + " p-value = " + mct.PValue.ToString());
     rd.addMessage("-".PadRight(100, '-')+"\n");
     rd.addMessage("Kappa comparison of two samples = " + akt.Statistic.ToString() + " DF = 1 p-value = " + akt.PValue.ToString());
     rd.addMessage("-".PadRight(100, '-') + "\n");
     string[] hdArr = (from s in labels select adjustString(s,5)).ToArray();
     string hd = "      | " + String.Join(" | ",hdArr);
     rd.addMessage(hd);
     rd.addMessage("-".PadRight(hd.Length,'-'));
     for (int i = 0; i < hdArr.Length; i++)
     {
         string lnStr = hdArr[i] + " | ";
         for (int j = 0; j < hdArr.Length; j++)
         {
             lnStr = lnStr + adjustString(g3table[j,i].ToString(),5) + " | ";
         }
         rd.addMessage(lnStr);
         rd.addMessage("-".PadRight(hd.Length, '-'));
     }
     rd.addMessage("Bhapkar's test of homogeneity = " + bht.Statistic.ToString() + " DF = " + bht.DegreesOfFreedom.ToString() + " p-value = " + bht.PValue.ToString());
     rd.addMessage("Bowker's test of symmetry = " + bkt.Statistic.ToString() + " DF = " + bkt.DegreesOfFreedom.ToString() + " p-value = " + bkt.PValue.ToString());
     rd.Show();
     rd.enableClose();
 }
 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();
 }
 public void getReport()
 {
     if (kmeans == null) buildModel();
     rd = new Forms.RunningProcess.frmRunningProcessDialog(false);
     rd.Text = "Independent T-Test Results";
     rd.TopLevel = true;
     rd.pgbProcess.Visible = false;
     rd.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Sizable;
     rd.addMessage("Input path = " + InPath);
     rd.addMessage("Total Sample size = " + n.ToString());
     rd.addMessage("\nLabel   |Compare V1-V2            |N       |Dif     |T-Stat  |P-Value ");
     rd.addMessage("-".PadRight(83,'-'));
     KMeansClusterCollection gCol = kmeans.Clusters;
     for (int i = 0; i < gCol.Count; i++)
     {
         string l = getValue(Labels[i],8);
         KMeansCluster gClust = gCol[i];
         double[] mns = gClust.Mean;
         double[] var = new double[mns.Length];
         double nSample = gClust.Proportion * N;
         if (nSample <= 1) continue;
         double seAdjust = Math.Sqrt(2*1/nSample);
         for (int j = 0; j < mns.Length; j++)
         {
             var[j] = gClust.Covariance[j, j];
         }
         int cnt = 1;
         for (int j = 0; j < mns.Length-1; j++)
         {
             for (int k = cnt; k < mns.Length; k++)
             {
                 string fN1 = getValue(VariableFieldNames[j],12);
                 string fN2 = getValue(VariableFieldNames[k],12);
                 double mD = mns[j] - mns[k];
                 double pSD = Math.Sqrt((var[j] + var[k]) / 2);
                 double se = pSD * seAdjust;
                 double tStat = mD / se;
                 Accord.Statistics.Distributions.Univariate.TDistribution tDist = new Accord.Statistics.Distributions.Univariate.TDistribution(2*nSample-2);
                 double cdf = tDist.DistributionFunction(tStat);
                 double pValue = 0;
                 if (tStat>0)
                 {
                     pValue = (1 - cdf) * 2;
                 }
                 else
                 {
                     pValue = (cdf * 2);
                 }
                 string pValueS = pValue.ToString();
                 if (pValue < 0.0001) pValueS = "p < 0.0001";
                 string ln = l + "|" + fN1 + "-" + fN2 + "| " + getValue(nSample.ToString(), 6) + " | " + getValue(mD.ToString(), 6) + " | " + getValue(tStat.ToString(), 6) + " | " + getValue(pValueS,10);
                 rd.addMessage(ln);
             }
             cnt += 1;
         }
     }
     rd.addMessage("-".PadRight(83, '-'));
     rd.enableClose();
     rd.Show();
 }
Ejemplo n.º 24
0
 new public void getReport()
 {
     if (cateDic.Count < 1)
     {
         buildModel();
     }
     rd                    = new Forms.RunningProcess.frmRunningProcessDialog(false);
     rd.Text               = "Paired T-Test Results";
     rd.TopLevel           = true;
     rd.pgbProcess.Visible = false;
     rd.FormBorderStyle    = System.Windows.Forms.FormBorderStyle.Sizable;
     rd.addMessage("Input path = " + InPath);
     rd.addMessage("Total Sample size = " + n.ToString());
     rd.addMessage("\nLabel   |Compare V1-V2            |N       |Dif     |T-Stat  |P-Value ");
     rd.addMessage("-".PadRight(83, '-'));
     for (int i = 0; i < lbl.Count; i++)
     {
         string labelVl = Labels[i];
         string l       = getValue(labelVl, 8);
         int    gN      = cateDic[labelVl];
         if (gN == 1)
         {
             continue;
         }
         double[] s   = sumX[i];
         double[] s2  = sumX2[i];
         double[] mns = (from double d in s select d / gN).ToArray();
         //Console.WriteLine("Means = " + mns.Length.ToString());
         double[] ses = getSe(s, s2, gN);
         //Console.WriteLine("Se = " + ses.Length.ToString());
         double nSample = gN;
         int    cnt     = 1;
         int    sCnt    = 0;
         for (int j = 0; j < VariableFieldNames.Length - 1; j++)
         {
             for (int k = cnt; k < VariableFieldNames.Length; k++)
             {
                 string fN1   = getValue(VariableFieldNames[j], 12);
                 string fN2   = getValue(VariableFieldNames[k], 12);
                 double mD    = mns[sCnt];
                 double se    = ses[sCnt];
                 double tStat = mD / se;
                 //Console.WriteLine(tStat.ToString());
                 Accord.Statistics.Distributions.Univariate.TDistribution tDist = new Accord.Statistics.Distributions.Univariate.TDistribution(nSample - 1);
                 double cdf    = tDist.DistributionFunction(tStat);
                 double pValue = 0;
                 if (tStat > 0)
                 {
                     pValue = (1 - cdf) * 2;
                 }
                 else
                 {
                     pValue = (cdf * 2);
                 }
                 string pValueS = pValue.ToString();
                 if (pValue < 0.0001)
                 {
                     pValueS = pValueS = "p < 0.0001";
                 }
                 string ln = l + "|" + fN1 + "-" + fN2 + "| " + getValue(nSample.ToString(), 6) + " | " + getValue(mD.ToString(), 6) + " | " + getValue(tStat.ToString(), 6) + " | " + getValue(pValueS, 10);
                 rd.addMessage(ln);
                 sCnt += 1;
             }
             cnt += 1;
         }
     }
     rd.addMessage("-".PadRight(83, '-'));
     rd.enableClose();
     rd.Show();
 }
        public void getReport()
        {
            Forms.RunningProcess.frmRunningProcessDialog rd = new Forms.RunningProcess.frmRunningProcessDialog(false);
            rd.Text = "Random Forest Results";
            rd.TopLevel = true;
            rd.pgbProcess.Visible = false;
            rd.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Sizable;
            rd.addMessage("Sample size = " + n.ToString());
            if (!(Categories == null || Categories.Length == 0))
            {
                rd.addMessage("Number of Classes = " + NumberOfClasses.ToString());
                rd.addMessage("Class Names and order = " + String.Join(", ", Categories));
            }
            rd.addMessage("Number of Parameters = " + NumberOfVariables.ToString());
            rd.addMessage("Number of Trees = " + NumberOfTrees.ToString());
            rd.addMessage("Data Ratio = " + Ratio.ToString());
            rd.addMessage("Number of Split Variables = " + NumberOfSplitVariables.ToString());
            rd.addMessage("Regression model = " + Regression.ToString()+"\n\nTraining Errors:\n");
            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("Relative Classification Error = " + RelativeClassificationError.ToString()+"\n\nValidation Errors:\n");
            rd.addMessage("OOBRMSE = " + OOBRMSE.ToString());
            rd.addMessage("OOBAverage Error = " + OOBAverageError.ToString());
            rd.addMessage("OOBAverage Relative Error = " + OOBAverageRelativeError.ToString());
            rd.addMessage("OOBAverage Cross Entropy Error = " + OOBAverageCrossEntropyError.ToString());
            rd.addMessage("OOBRelative Classification Error = " + OOBRelativeClassificationError.ToString());
            try
            {
                if (ModelHelper.chartingAvailable())
                {
                    if (!Regression)
                    {
                        if (System.Windows.Forms.MessageBox.Show("Do you want to build probability graphs?", "Graphs", System.Windows.Forms.MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
                        {
                            getRegChart();
                            if (variableImportanceGraph)
                            {
                                getVariableImportanceChart();
                            }

                        }
                    }
                    else
                    {
                        if (System.Windows.Forms.MessageBox.Show("Do you want to build predicted values graphs?", "Graphs", System.Windows.Forms.MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
                        {
                            getProbChart();
                            if (variableImportanceGraph)
                            {
                                getVariableImportanceChart();
                            }
                        }
                    }
                }
            }
            catch
            {
                System.Windows.Forms.MessageBox.Show("Cannot create charts");
            }
            finally
            {
                rd.Show();
                rd.enableClose();
            }
        }
 public void getReport(double alpha)
 {
     if(gConf==null)buildModel();
     Forms.RunningProcess.frmRunningProcessDialog rd = new Forms.RunningProcess.frmRunningProcessDialog(false);
     rd.Text = "Accuracy Assessment";
     rd.TopLevel = true;
     rd.pgbProcess.Visible = false;
     rd.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Sizable;
     string[] hd = new string[labels.Count];
     for (int i = 0; i < hd.Length; i++)
     {
         string s = labels[i];
         if(s.Length>4)
         {
             hd[i] = s.Substring(0, 4);
         }
         else
         {
             hd[i] = s.PadRight(3);
         }
     }
     rd.addMessage("       "+String.Join("   ", hd));
     rd.addMessage("------".PadRight((labels.Count+1)*7,'-'));
     for (int i = 0; i < labels.Count; i++)
     {
         string[] lnArr = new string[labels.Count+1];
         string vl = labels[i];
         if (vl.Length > 4)
         {
             vl = vl.Substring(0, 4);
         }
         else
         {
             vl = vl.PadRight(4);
         }
         lnArr[0] = vl;
         for (int j = 0; j < labels.Count; j++)
         {
             vl = xtable[i,j].ToString();
             if (vl.Length < 4)
             {
                 vl = vl.PadRight(4);
             }
             lnArr[j + 1] = vl;
         }
         rd.addMessage(String.Join(" | ", lnArr)+"|");
         rd.addMessage("------".PadRight((labels.Count+1) * 7, '-'));
     }
     Accord.Statistics.Testing.ChiSquareTest ct = new Accord.Statistics.Testing.ChiSquareTest(ChiSquare, System.Convert.ToInt32(Math.Pow(labels.Count - 1, 2)));
     rd.addMessage("Chi-square = " + ChiSquare + " DF = " + ct.DegreesOfFreedom.ToString() + " p-value = " + ct.PValue.ToString());
     rd.addMessage("Overall = " + Overall.ToString());
     rd.addMessage("Kappa = " + Kappa.ToString());
     rd.addMessage("STE = " + STE.ToString());
     ci conf = getConfidenceInterval(alpha);
     rd.addMessage("Kappa CI = " + conf.LowerBound.ToString() + " - " + conf.UpperBound.ToString());
     rd.addMessage("Cohen Kappa Variance = " + CohenKappaVariance.ToString());
     rd.Show();
     rd.enableClose();
 }
        public void getReport(double alpha)
        {
            Forms.RunningProcess.frmRunningProcessDialog rd = new Forms.RunningProcess.frmRunningProcessDialog(false);
            rd.Text = "PLR Results";
            rd.TopLevel = true;
            rd.pgbProcess.Visible = false;
            rd.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Sizable;
            rd.addMessage("Iterations = " + NumberOfIterationsToConverge.ToString());
            rd.addMessage("Convergence = " + Delta.ToString());
            rd.addMessage("LogLikelihood = " + LogLikelihood.ToString());
            rd.addMessage("Deviance = " + Deviance.ToString());
            rd.addMessage("Likelihood Ratio Chi-squared = " + X2.ToString() + " DF = " + DegreesOfFredom.ToString() + " p-value = " + PValue.ToString());
            rd.addMessage("\n\nClasses: " + String.Join(", ", Categories));
            rd.addMessage("Reference Class = " + Categories[0]);
            rd.addMessage("\nParameter coefficients:\n");
            rd.addMessage("intercept, " + String.Join(", ", IndependentFieldNames));
            for (int i = 0; i < Coefficients.Length; i++)
            {
                double[] c = Coefficients[i];
                rd.addMessage(String.Join(" ", (from double d in c select d.ToString()).ToArray()));
            }
            rd.addMessage("\nParameter standard error:");
            for (int i = 0; i < StandardError.Length; i++)
            {
                double[] c = StandardError[i];
                rd.addMessage(String.Join(", ", (from double d in c select d.ToString()).ToArray()));
            }
            rd.addMessage("\nParameter Wald Chi-Squared:");
            for (int i = 0; i < WaldStatistic.Length; i++)
            {
                double[] c = WaldStatistic[i];
                rd.addMessage(String.Join(", ", (from double d in c select d.ToString()).ToArray()));
            }
            rd.addMessage("\nParameter Wald P-value:");
            for (int i = 0; i < WaldPvalue.Length; i++)
            {
                double[] c = WaldPvalue[i];
                rd.addMessage(String.Join(", ", (from double d in c select d.ToString()).ToArray()));
            }
            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)
                {
                    regChart();
                    //if (mlr == null) mlr = buildModel();

                }
            }
            catch
            {
                System.Windows.Forms.MessageBox.Show("Cannot create charts");
            }
            rd.Show();
            rd.enableClose();
        }
Ejemplo n.º 28
0
        public static void getReport(string modelPath, double proportion = 0.1, double alpha = 0.05)
        {
            esriUtil.Forms.RunningProcess.frmRunningProcessDialog rp = new Forms.RunningProcess.frmRunningProcessDialog(false);
            rp.addMessage("Sample size for " + modelPath + " based on variation");
            rp.stepPGBar(50);
            rp.Show();
            dataPrepBase.modelTypes mType = ModelHelper.getModelType(modelPath);
            rp.addMessage("Model Type = " + mType.ToString());
            try
            {
                switch (mType)
                {
                case dataPrepBase.modelTypes.Accuracy:
                    fillAaReport(modelPath, rp, proportion, alpha);
                    break;

                case dataPrepBase.modelTypes.LinearRegression:
                    fillLrReport(modelPath, rp, proportion, alpha);
                    break;

                case dataPrepBase.modelTypes.MvlRegression:
                    fillMvrReport(modelPath, rp, proportion, alpha);
                    break;

                case dataPrepBase.modelTypes.LogisticRegression:
                    fillLogisticReport(modelPath, rp, proportion, alpha);
                    break;

                case dataPrepBase.modelTypes.PLR:
                    fillPlrReport(modelPath, rp, proportion, alpha);
                    break;

                case dataPrepBase.modelTypes.CovCorr:
                    fillCovCorr(modelPath, rp, proportion, alpha);
                    break;

                case dataPrepBase.modelTypes.PCA:
                    fillPcaReport(modelPath, rp, proportion, alpha);
                    break;

                case dataPrepBase.modelTypes.Cluster:
                    fillCluserReport(modelPath, rp, proportion, alpha);
                    break;

                case dataPrepBase.modelTypes.StrataCovCorr:
                    fillStrataReport(modelPath, rp, proportion, alpha);
                    break;

                default:
                    rp.addMessage("Can't estimate sample size for this type of model!");
                    break;
                }
            }
            catch (Exception e)
            {
                rp.addMessage(e.ToString());
            }
            finally
            {
                rp.stepPGBar(100);
                rp.enableClose();
            }
        }
Ejemplo n.º 29
0
        public void getReport()
        {
            if (kmeans == null)
            {
                buildModel();
            }
            rd                    = new Forms.RunningProcess.frmRunningProcessDialog(false);
            rd.Text               = "Independent T-Test Results";
            rd.TopLevel           = true;
            rd.pgbProcess.Visible = false;
            rd.FormBorderStyle    = System.Windows.Forms.FormBorderStyle.Sizable;
            rd.addMessage("Input path = " + InPath);
            rd.addMessage("Total Sample size = " + n.ToString());
            rd.addMessage("\nLabel   |Compare V1-V2            |N       |Dif     |T-Stat  |P-Value ");
            rd.addMessage("-".PadRight(83, '-'));
            KMeansClusterCollection gCol = kmeans.Clusters;

            for (int i = 0; i < gCol.Count; i++)
            {
                string        l       = getValue(Labels[i], 8);
                KMeansCluster gClust  = gCol[i];
                double[]      mns     = gClust.Mean;
                double[]      var     = new double[mns.Length];
                double        nSample = gClust.Proportion * N;
                if (nSample <= 1)
                {
                    continue;
                }
                double seAdjust = Math.Sqrt(2 * 1 / nSample);
                for (int j = 0; j < mns.Length; j++)
                {
                    var[j] = gClust.Covariance[j, j];
                }
                int cnt = 1;
                for (int j = 0; j < mns.Length - 1; j++)
                {
                    for (int k = cnt; k < mns.Length; k++)
                    {
                        string fN1   = getValue(VariableFieldNames[j], 12);
                        string fN2   = getValue(VariableFieldNames[k], 12);
                        double mD    = mns[j] - mns[k];
                        double pSD   = Math.Sqrt((var[j] + var[k]) / 2);
                        double se    = pSD * seAdjust;
                        double tStat = mD / se;
                        Accord.Statistics.Distributions.Univariate.TDistribution tDist = new Accord.Statistics.Distributions.Univariate.TDistribution(2 * nSample - 2);
                        double cdf    = tDist.DistributionFunction(tStat);
                        double pValue = 0;
                        if (tStat > 0)
                        {
                            pValue = (1 - cdf) * 2;
                        }
                        else
                        {
                            pValue = (cdf * 2);
                        }
                        string pValueS = pValue.ToString();
                        if (pValue < 0.0001)
                        {
                            pValueS = "p < 0.0001";
                        }
                        string ln = l + "|" + fN1 + "-" + fN2 + "| " + getValue(nSample.ToString(), 6) + " | " + getValue(mD.ToString(), 6) + " | " + getValue(tStat.ToString(), 6) + " | " + getValue(pValueS, 10);
                        rd.addMessage(ln);
                    }
                    cnt += 1;
                }
            }
            rd.addMessage("-".PadRight(83, '-'));
            rd.enableClose();
            rd.Show();
        }
        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();
        }
 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();
 }
        public void getReport()
        {
            if (model == null) buildModel();
            Forms.RunningProcess.frmRunningProcessDialog rd = new Forms.RunningProcess.frmRunningProcessDialog(false);
            rd.Text = "Cluster Results";
            rd.TopLevel = true;
            rd.pgbProcess.Visible = false;
            rd.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Sizable;
            rd.addMessage("Input path = " + InPath);
            rd.addMessage("Sample size = " + n.ToString() + " proportion of total records = " + prop.ToString());
            rd.addMessage("Number of Cluster = " + k.ToString());
            rd.addMessage("Labels = " + String.Join(", ", lbl.ToArray()));
            rd.addMessage("Variables: " + String.Join(" ,", VariableFieldNames));
            rd.addMessage("Cluster Type: " + cType.ToString());
            switch (cType)
            {
                case clusterType.KMEANS:
                    kmeansReport(rd);
                    break;
                case clusterType.BINARY:
                    binaryReport(rd);
                    break;
                case clusterType.GAUSSIANMIXTURE:
                    gaussianReport(rd);
                    break;
                default:
                    break;
            }

            rd.enableClose();
            rd.Show();
        }
 public void getReport()
 {
     Forms.RunningProcess.frmRunningProcessDialog rd = new Forms.RunningProcess.frmRunningProcessDialog(false);
     rd.Text = "KDA 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();
 }
 public new void getReport()
 {
     if (cateDic.Count<1) buildModel();
     rd = new Forms.RunningProcess.frmRunningProcessDialog(false);
     rd.Text = "Paired T-Test Results";
     rd.TopLevel = true;
     rd.pgbProcess.Visible = false;
     rd.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Sizable;
     rd.addMessage("Input path = " + InPath);
     rd.addMessage("Total Sample size = " + n.ToString());
     rd.addMessage("\nLabel   |Compare V1-V2            |N       |Dif     |T-Stat  |P-Value ");
     rd.addMessage("-".PadRight(83, '-'));
     for (int i = 0; i < lbl.Count; i++)
     {
         string labelVl = Labels[i];
         string l = getValue(labelVl, 8);
         int gN = cateDic[labelVl];
         if (gN == 1) continue;
         double[] s = sumX[i];
         double[] s2 = sumX2[i];
         double[] mns = (from double d in s select d/gN).ToArray();
         //Console.WriteLine("Means = " + mns.Length.ToString());
         double[] ses = getSe(s, s2, gN);
         //Console.WriteLine("Se = " + ses.Length.ToString());
         double nSample = gN;
         int cnt = 1;
         int sCnt = 0;
         for (int j = 0; j < VariableFieldNames.Length-1; j++)
         {
             for (int k = cnt; k < VariableFieldNames.Length; k++)
             {
                 string fN1 = getValue(VariableFieldNames[j], 12);
                 string fN2 = getValue(VariableFieldNames[k], 12);
                 double mD = mns[sCnt];
                 double se = ses[sCnt];
                 double tStat = mD / se;
                 //Console.WriteLine(tStat.ToString());
                 Accord.Statistics.Distributions.Univariate.TDistribution tDist = new Accord.Statistics.Distributions.Univariate.TDistribution(nSample - 1);
                 double cdf = tDist.DistributionFunction(tStat);
                 double pValue = 0;
                 if (tStat > 0)
                 {
                     pValue = (1 - cdf) * 2;
                 }
                 else
                 {
                     pValue = (cdf * 2);
                 }
                 string pValueS = pValue.ToString();
                 if (pValue < 0.0001) pValueS = pValueS = "p < 0.0001";
                 string ln = l + "|" + fN1 + "-" + fN2 + "| " + getValue(nSample.ToString(), 6) + " | " + getValue(mD.ToString(), 6) + " | " + getValue(tStat.ToString(), 6) + " | " + getValue(pValueS,10);
                 rd.addMessage(ln);
                 sCnt += 1;
             }
             cnt += 1;
         }
     }
     rd.addMessage("-".PadRight(83, '-'));
     rd.enableClose();
     rd.Show();
 }
Ejemplo n.º 35
0
        public void getReport(double alpha)
        {
            if (gConf == null)
            {
                buildModel();
            }
            Forms.RunningProcess.frmRunningProcessDialog rd = new Forms.RunningProcess.frmRunningProcessDialog(false);
            rd.Text               = "Accuracy Assessment";
            rd.TopLevel           = true;
            rd.pgbProcess.Visible = false;
            rd.FormBorderStyle    = System.Windows.Forms.FormBorderStyle.Sizable;
            string[] hd = new string[labels.Count];
            for (int i = 0; i < hd.Length; i++)
            {
                string s = labels[i];
                if (s.Length > 4)
                {
                    hd[i] = s.Substring(0, 4);
                }
                else
                {
                    hd[i] = s.PadRight(3);
                }
            }
            rd.addMessage("       " + String.Join("   ", hd));
            rd.addMessage("------".PadRight((labels.Count + 1) * 7, '-'));
            for (int i = 0; i < labels.Count; i++)
            {
                string[] lnArr = new string[labels.Count + 1];
                string   vl    = labels[i];
                if (vl.Length > 4)
                {
                    vl = vl.Substring(0, 4);
                }
                else
                {
                    vl = vl.PadRight(4);
                }
                lnArr[0] = vl;
                for (int j = 0; j < labels.Count; j++)
                {
                    vl = xtable[i, j].ToString();
                    if (vl.Length < 4)
                    {
                        vl = vl.PadRight(4);
                    }
                    lnArr[j + 1] = vl;
                }
                rd.addMessage(String.Join(" | ", lnArr) + "|");
                rd.addMessage("------".PadRight((labels.Count + 1) * 7, '-'));
            }
            Accord.Statistics.Testing.ChiSquareTest ct = new Accord.Statistics.Testing.ChiSquareTest(ChiSquare, System.Convert.ToInt32(Math.Pow(labels.Count - 1, 2)));
            rd.addMessage("Chi-square = " + ChiSquare + " DF = " + ct.DegreesOfFreedom.ToString() + " p-value = " + ct.PValue.ToString());
            rd.addMessage("Overall = " + Overall.ToString());
            rd.addMessage("Kappa = " + Kappa.ToString());
            rd.addMessage("STE = " + STE.ToString());
            ci conf = getConfidenceInterval(alpha);

            rd.addMessage("Kappa CI = " + conf.LowerBound.ToString() + " - " + conf.UpperBound.ToString());
            rd.addMessage("Cohen Kappa Variance = " + CohenKappaVariance.ToString());
            rd.Show();
            rd.enableClose();
        }
 public void getReport()
 {
     if (cov == null) buildModel();
     Forms.RunningProcess.frmRunningProcessDialog rd = new Forms.RunningProcess.frmRunningProcessDialog(false);
     rd.Text = "Variance Covariance Results";
     rd.TopLevel = true;
     rd.pgbProcess.Visible = false;
     rd.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Sizable;
     rd.addMessage("Sample size = " + n.ToString());
     rd.addMessage("Vars:  " + String.Join(", ", VariableFieldNames));
     rd.addMessage("\nSum:  " + String.Join(", ", (from double d in SumsVector select d.ToString()).ToArray()));
     rd.addMessage("\nMean: " + String.Join(", ", (from double d in MeanVector select d.ToString()).ToArray()));
     rd.addMessage("\n\nSample Variance Covariance:\n");
     double[,] scov = CovarianceMatrix;
     for (int i = 0; i < SumsVector.Length; i++)
     {
         string[] vlArr = new string[SumsVector.Length];
         for (int j = 0; j < SumsVector.Length; j++)
         {
             vlArr[j] = scov[j, i].ToString();
         }
         rd.addMessage(String.Join(", ", vlArr));
     }
     double[,] corr = CorralationMatrix;
     rd.addMessage("\n\nCorr:\n");
     for (int i = 0; i < SumsVector.Length; i++)
     {
         string[] vlArr = new string[SumsVector.Length];
         for (int j = 0; j < SumsVector.Length; j++)
         {
             vlArr[j] = corr[j, i].ToString();
         }
         rd.addMessage(String.Join(", ", vlArr));
     }
     rd.Show();
     rd.enableClose();
 }
        public void getReport()
        {
            if (kmeans == null) buildModel();
            Forms.RunningProcess.frmRunningProcessDialog rd = new Forms.RunningProcess.frmRunningProcessDialog(false);
            rd.Text = "Cluster Results";
            rd.TopLevel = true;
            rd.pgbProcess.Visible = false;
            rd.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Sizable;
            rd.addMessage("Input path = " + InPath);
            rd.addMessage("Sample size = " + n.ToString() + " proportion of total records = " + prop.ToString() );
            rd.addMessage("Number of Cluster = " + k.ToString());
            rd.addMessage("Labels = " + String.Join(", ", lbl.ToArray()));
            rd.addMessage("Variables: " + String.Join(" ,", VariableFieldNames));
            KMeansClusterCollection gCol = kmeans.Clusters;
            for (int i = 0; i < gCol.Count; i++)
            {
                KMeansCluster gClust = gCol[i];
                double[] mns = gClust.Mean;
                double[,] cov = gClust.Covariance;
                rd.addMessage("\n\nCluster " + Labels[i] + ":\nMeans: " + String.Join(", ", (from double d in mns select d.ToString()).ToArray()) + "\nCovariance:");
                for (int j = 0; j < VariableFieldNames.Length; j++)
                {
                    string[] covStrArr = new string[VariableFieldNames.Length];
                    for (int l = 0; l < covStrArr.Length; l++)
                    {
                        covStrArr[l] = cov[l, j].ToString();
                    }
                    rd.addMessage("\n" + String.Join(",", covStrArr));
                }

            }
            rd.enableClose();
            rd.Show();
        }
        public void getReport()
        {
            Forms.RunningProcess.frmRunningProcessDialog rd = new Forms.RunningProcess.frmRunningProcessDialog(false);
            rd.Text = "Kolmogorov Smirnov Two sample distribution Results (p-value for unequal distributions)";
            rd.TopLevel = true;
            rd.pgbProcess.Visible = false;
            rd.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Sizable;
            rd.addMessage("Vars:  " + String.Join(", ", Variables));
            rd.addMessage("Perform PCA " + Oridinate.ToString());
            rd.addMessage("Strata Field = " + StrataField);
            rd.addMessage("\n Label   | Statistic  | WP value   | WS p-value");
            rd.addMessage("-".PadRight(48,'-'));
            for (int i = 0; i < Labels.Length; i++)
            {
                string ky = Labels[i];
                double stat = StatisticValues[i];
                string sVl = stat.ToString();
                double vl = PValues[i];
                string fVl = vl.ToString();
                if (vl < 0.0001) fVl = "p < 0.0001";
                double wVl = WSpvalues[i];
                string wspStr = wVl.ToString();
                if (wVl < 0.0001) wspStr = "p < 0.0001";
                string l = ModelHelper.getValue(ky,8);
                string wp = ModelHelper.getValue(fVl,10);
                string s = ModelHelper.getValue(sVl, 10);
                string wsp = ModelHelper.getValue(wspStr, 10);
                rd.addMessage(l + " | " + s +" | " + wp + " | " + wsp);
            }
            rd.addMessage("-".PadRight(48, '-'));

            if (ModelHelper.chartingAvailable())
            {
                createKSchart();
            }
            rd.enableClose();
            rd.Show();
        }