Esempio n. 1
0
        /// <summary>
        /// Perform an EM clustering on each plate independantely
        /// </summary>
        /// <param name="CurrentPlateToProcess">the plate to process</param>
        /// <param name="ClassNumber">Number of class</param>
        private void ClusteringEMSinglePlate(cPlate CurrentPlateToProcess, int ClassNumber, FormForEMInfo WindowEMinfo)
        {
            weka.core.Instances Ninsts = CurrentPlateToProcess.CreateInstancesWithoutClass();// CreateInstanceWithoutClass(CurrentTable);

            weka.clusterers.EM EMCluster = new EM();
            EMCluster.setNumClusters(ClassNumber);

            EMCluster.setMaxIterations((int)WindowEMinfo.numericUpDownMaxIterations.Value);
            EMCluster.setMinStdDev((double)WindowEMinfo.numericUpDownMinStdev.Value);
            EMCluster.setSeed((int)WindowEMinfo.numericUpDownSeedNumber.Value);

            EMCluster.buildClusterer(Ninsts);
            EMCluster.getClusterModelsNumericAtts();
            if (EMCluster.numberOfClusters() > cGlobalInfo.ListWellClasses.Count)
            {
                richTextBoxInfoClustering.AppendText("\n Plate " + CurrentPlateToProcess.GetName() + ", cluster Number: more than " + cGlobalInfo.ListWellClasses.Count + ", clustering not operated.\n");
                return;
            }
            else
                richTextBoxInfoClustering.AppendText("\n" + CurrentPlateToProcess.GetName() + ": " + EMCluster.numberOfClusters() + " cluster(s)");

            ClusterEvaluation eval = new ClusterEvaluation();
            eval.setClusterer(EMCluster);
            eval.evaluateClusterer(Ninsts);

            CurrentPlateToProcess.AssignClass(eval.getClusterAssignments());
        }
Esempio n. 2
0
        /// <summary>
        /// Perform an EM clustering on each plate independantely
        /// </summary>
        /// <param name="CurrentPlateToProcess">the plate to process</param>
        /// <param name="ClassNumber">Number of class</param>
        private void ClusteringEMSinglePlate(cPlate CurrentPlateToProcess, int ClassNumber, FormForEMInfo WindowEMinfo)
        {
            weka.core.Instances Ninsts = CurrentPlateToProcess.CreateInstancesWithoutClass();// CreateInstanceWithoutClass(CurrentTable);
            if (Ninsts.numInstances() == 0)
            {
                MessageBox.Show("No active wells !", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            weka.clusterers.EM EMCluster = new EM();
            EMCluster.setNumClusters(ClassNumber);

            EMCluster.setMaxIterations((int)WindowEMinfo.numericUpDownMaxIterations.Value);
            EMCluster.setMinStdDev((double)WindowEMinfo.numericUpDownMinStdev.Value);
            EMCluster.setSeed((int)WindowEMinfo.numericUpDownSeedNumber.Value);

            EMCluster.buildClusterer(Ninsts);
            EMCluster.getClusterModelsNumericAtts();
            if (EMCluster.numberOfClusters() > GlobalInfo.GetNumberofDefinedClass())
            {
                richTextBoxInfoClustering.AppendText("\n Plate " + CurrentPlateToProcess.Name + ", cluster Number: more than " + GlobalInfo.GetNumberofDefinedClass() + ", clustering not operated.\n");
                return;
            }
            else
                richTextBoxInfoClustering.AppendText("\n" + CurrentPlateToProcess.Name + ": " + EMCluster.numberOfClusters() + " cluster(s)");

            ClusterEvaluation eval = new ClusterEvaluation();
            eval.setClusterer(EMCluster);
            eval.evaluateClusterer(Ninsts);

            CurrentPlateToProcess.AssignClass(eval.getClusterAssignments());
        }
Esempio n. 3
0
        /// <summary>
        /// Perform an Hierarchical clustering on each plate independantely
        /// </summary>
        /// <param name="CurrentPlateToProcess">the plate to process</param>
        /// <param name="ClassNumber">Number of class</param>
        private void ClusteringHierarchicalSinglePlate(cPlate CurrentPlateToProcess, int ClassNumber)
        {
            weka.core.Instances Ninsts = CurrentPlateToProcess.CreateInstancesWithoutClass();

            weka.clusterers.HierarchicalClusterer HClusterer = new HierarchicalClusterer();

            //string OptionDistance = " -A \"weka.core.";
            string OptionDistance = " -A \"";

            switch (cGlobalInfo.OptionsWindow.comboBoxHierarchicalDistance.SelectedIndex)
            {
                case 0:
                    OptionDistance += "EuclideanDistance";
                    break;
                case 1:
                    OptionDistance += "ManhattanDistance";
                    break;
                case 2:
                    OptionDistance += "ChebyshevDistance";
                    break;
                default:
                    break;
            }

            OptionDistance += " -R first-last\"";

            string[] TAGS_LINK_TYPE = { "SINGLE", "COMPLETE", "AVERAGE", "MEAN", "CENTROID", "WARD", "ADJCOMPLETE" };

            string WekaOption = "-L " + TAGS_LINK_TYPE[cGlobalInfo.OptionsWindow.comboBoxHierarchicalLinkType.SelectedIndex];// + OptionDistance;

            HClusterer.setOptions(weka.core.Utils.splitOptions(WekaOption));
            //EuclideanDistance2 Dist2 = new EuclideanDistance2();

            //HClusterer.setDistanceFunction(Dist2);
            HClusterer.setNumClusters(ClassNumber);
            HClusterer.buildClusterer(Ninsts);

            richTextBoxInfoClustering.AppendText("\n" + CurrentPlateToProcess.GetName() + ": " + HClusterer.numberOfClusters() + " cluster(s)");

            ClusterEvaluation eval = new ClusterEvaluation();
            eval.setClusterer(HClusterer);
            eval.evaluateClusterer(Ninsts);

            CurrentPlateToProcess.AssignClass(eval.getClusterAssignments());
        }
Esempio n. 4
0
        /// <summary>
        /// Perform an EM clustering on each plate independantely
        /// </summary>
        /// <param name="CurrentPlateToProcess">the plate to process</param>
        /// <param name="ClassNumber">Number of class</param>
        private void ClusteringEMSinglePlate(cPlate CurrentPlateToProcess, int ClassNumber)
        {
            weka.core.Instances Ninsts = CurrentPlateToProcess.CreateInstancesWithoutClass();// CreateInstanceWithoutClass(CurrentTable);

            weka.clusterers.EM EMCluster = new EM();
            EMCluster.setNumClusters(ClassNumber);

            EMCluster.buildClusterer(Ninsts);
            EMCluster.getClusterModelsNumericAtts();
            if (EMCluster.numberOfClusters() > GlobalInfo.GetNumberofDefinedClass())
            {
                richTextBoxInfoClustering.AppendText("\n Plate " + CurrentPlateToProcess.Name + ", cluster Number: more than " + GlobalInfo.GetNumberofDefinedClass() + ", clustering not operated.\n");
                return;
            }
            else
                richTextBoxInfoClustering.AppendText("\n" + CurrentPlateToProcess.Name + ": " + EMCluster.numberOfClusters() + " cluster(s)");

            ClusterEvaluation eval = new ClusterEvaluation();
            eval.setClusterer(EMCluster);
            eval.evaluateClusterer(Ninsts);

            CurrentPlateToProcess.AssignClass(eval.getClusterAssignments());
        }