Exemple #1
0
        private void buttonROC_Click(object sender, EventArgs e)
        {
            ReceiverOperatingCharacteristic roc = null;
            int    numPoints    = -1;
            string numPointsStr = "";

            Utility.InputBox("ROC Points", "How many points should be used?", ref numPointsStr);
            if (numPointsStr != "")
            {
                if (!Int32.TryParse(numPointsStr, out numPoints))
                {
                    MessageBox.Show("Your input was invalid. Please try again.");
                    return;
                }
            }


            switch (_scheme)
            {
            case VotingScheme.NONE:
            {
                roc = _voter.getROC();
                break;
            }

            case VotingScheme.MAJORITY_VOTE:
            {
                roc = _voter.getMajorityVote().getROC();
                break;
            }

            case VotingScheme.ADDITIVE_PREDICTIONS:
            {
                roc = _voter.getSumPredictions().getROC();
                break;
            }

            default:
            {
                break;
            }
            }

            if (roc != null)
            {
                roc.Compute(numPoints);
                FormDataView <double> f = new FormDataView <double>(roc);
                f.Show();
            }
            else
            {
                if (MessageBox.Show(this, "This voter does not offer ROC computation.\nWould you like to compute a general (non-vote) ROC from the data?", "ROC Computation", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
                {
                    roc = _voter.getROC();
                    roc.Compute(numPoints);
                    FormDataView <double> f = new FormDataView <double>(roc);
                    f.Show();
                }
            }
        }
Exemple #2
0
        public void testSVM()
        {
            if (_svm == null)
            {
                return;
            }

            int[] output = new int[_outputs.Length];

            // Compute the machine outputs
            for (int i = 0; i < _outputs.Length; i++)
            {
                double actual    = _outputs[i];
                double predicted = _svm.Compute(_inputs[i]);
                // System.Console.WriteLine(Math.Sign(actual) + "   " + _names[i] + "   =>   " + predicted + "   =>   " + Math.Sign(predicted));
                output[i] = System.Math.Sign(predicted);
            }

            // Use confusion matrix to compute some performance metrics
            ConfusionMatrix       confusionMatrix = new ConfusionMatrix(output, _outputs, 1, -1);
            FormDataView <double> f = new FormDataView <double>(new[] { confusionMatrix });

            f.Show();
            //dgvPerformance.DataSource = new[] { confusionMatrix };
        }
Exemple #3
0
        private void buttonShowGeneric_Click(object sender, EventArgs e)
        {
            FormDataView <double> f = new FormDataView <double>(new[] { _voter.AggregatedConfusionMatrix });

            f.Show();
        }
        internal void showSummary()
        {
            if (_tableSummary == null)
            {
                _tableSummary = new DataTable();
                _tableSummary.Columns.Add("Category");
                _tableSummary.Columns.Add("Samples");
                _tableSummary.Columns.Add("AP");
                _tableSummary.Columns.Add("AN");
                _tableSummary.Columns.Add("TP");
                _tableSummary.Columns.Add("FP");
                _tableSummary.Columns.Add("TN");
                _tableSummary.Columns.Add("FN");
                _tableSummary.Columns.Add("Predictions/Node", typeof(String));
                _tableSummary.Columns.Add("AP-CM");
                _tableSummary.Columns.Add("AN-CM");
                _tableSummary.Columns.Add("TP-CM");
                _tableSummary.Columns.Add("FP-CM");
                _tableSummary.Columns.Add("TN-CM");
                _tableSummary.Columns.Add("FN-CM");
                _tableSummary.Columns.Add("Sensitivity");
                _tableSummary.Columns.Add("FPR");
                _tableSummary.Columns.Add("Precision");
                _tableSummary.Columns.Add("AUC");
                _tableSummary.Columns.Add("FScore");
                //_tableSummary.Columns.Add("Num Predictions", typeof(String));
                //_tableSummary.Columns.Add("Correct", typeof(String));
                //_tableSummary.Columns.Add("False", typeof(String));
                //_tableSummary.Columns.Add("Total Votes (Nodes)", typeof(String));
                //_tableSummary.Columns.Add("Correct Votes", typeof(String));
                //_tableSummary.Columns.Add("False Votes", typeof(String));
                //_tableSummary.Columns.Add("Sensitivity (TPR)", typeof(String));
                //_tableSummary.Columns.Add("Specificity (TNR)", typeof(String));
                //_tableSummary.Columns.Add("Precision (PPV)", typeof(String));
                //_tableSummary.Columns.Add("Accuracy", typeof(String));
                //_tableSummary.Columns.Add("FPR", typeof(String));
                //_tableSummary.Columns.Add("FDR", typeof(String));



                _tableSummary.Rows.Add("Base",
                                       Samples, AP, AN, TP, FP, TN, FN,
                                       _numPredictionsPerNode.ToString(),
                                       _baseMatrix.ActualPositives,
                                       _baseMatrix.ActualNegatives,
                                       _baseMatrix.TruePositives,
                                       _baseMatrix.FalsePositives,
                                       _baseMatrix.TrueNegatives,
                                       _baseMatrix.FalseNegatives,
                                       _baseMatrix.Sensitivity,
                                       _baseMatrix.FalsePositiveRate,
                                       _baseMatrix.Precision,
                                       rocAreaBase,
                                       _baseMatrix.FScore);

                _tableSummary.Rows.Add("Voter",
                                       VSamples, VAP, VAN, VTP, VFP, VTN, VFN,
                                       _numPredictionsPerNode.ToString(),
                                       _voterMatrix.ActualPositives,
                                       _voterMatrix.ActualNegatives,
                                       _voterMatrix.TruePositives,
                                       _voterMatrix.FalsePositives,
                                       _voterMatrix.TrueNegatives,
                                       _voterMatrix.FalseNegatives,
                                       _voterMatrix.Sensitivity,
                                       _voterMatrix.FalsePositiveRate,
                                       _voterMatrix.Precision,
                                       rocAreaVoter,
                                       _voterMatrix.FScore);
                //_tableSummary.Rows.Add(VSamples, VAP, VAN, VTP, VFP, VTN, VFN, _numPredictionsPerNode.ToString(), _voterMatrix.ActualNegatives, _voterMatrix.ActualPositives, _voterMatrix.TruePositives, _voterMatrix.FalsePositives, _voterMatrix.TrueNegatives, _voterMatrix.FalseNegatives);
            }

            FormDataView <string> f = new FormDataView <string>(_tableSummary);

            f.Show();
        }
        internal void showDetails()
        {
            FormDataView <string> f = new FormDataView <string>(_tableDetails);

            f.Show();
        }