Beispiel #1
0
        //This will calculate the errors
        //first it must ask what column to use as a label
        private void externalEvalCalculateButton_Click(object sender, EventArgs e)
        {
            //start by parsing label file
            DelimitedFile delimitedLabelFile = new DelimitedFile(externalEvalLabelText.Text);
            int           labelCol           = Prompt.ShowDialog("Enter the Column to use", "Select Attribute", 1, delimitedLabelFile.Data[0].Length);
            LabelList     labels             = new LabelList(delimitedLabelFile.GetColumn(labelCol - 1));

            //get the Partion file
            Partition clusterFile   = new Partition(externalEvalClusterText.Text);
            int       countOfPoints = clusterFile.DataCount;

            //create a count mapping
            //[actual cluster label, number in found clusters]
            int[,] clusterMatching = new int[labels.UniqueLabels.Count, clusterFile.Clusters.Count];
            foreach (Cluster c in clusterFile.Clusters)
            {
                foreach (ClusteredItem k in c.Points)
                {
                    int actualMatching = labels.LabelIndices[k.Id];
                    int foundMatching  = k.ClusterId;
                    clusterMatching[actualMatching, foundMatching]++;
                }
            }

            //One-To-One Mapping like Darla's
            String greedyError = ExternalEval.GreedyErrorEval(clusterFile, labels, clusterMatching);

            externalEvalResultText.Text = greedyError;
        }
        //This will calculate the errors
        //first it must ask what column to use as a label
        private void externalEvalCalculateButton_Click(object sender, EventArgs e)
        {
            //start by parsing label file
            DelimitedFile delimitedLabelFile = new DelimitedFile(externalEvalLabelText.Text);
            int           labelCol           = Prompt.ShowDialog("Enter the Column to use", "Select Attribute", 1, delimitedLabelFile.Data[0].Length);
            LabelList     labels             = new LabelList(delimitedLabelFile.GetColumn(labelCol - 1));

            //get the Partion file
            Partition clusterFile = new Partition(externalEvalClusterText.Text);

            //Calculate the Error
            ExternalEval error = new ExternalEval(clusterFile, labels);

            externalEvalResultText.Text = error.TextResults;
        }