コード例 #1
0
 public DFSGroupsMiner(Dataset ds, DualCompare dc)
     : base(ds, dc)
 {
 }
コード例 #2
0
        public static MineResults DoMine(MinerParams minerParams)
        {
            int parameter1 = 0;

            OPSM.Dataset dataset    = null;
            MineResults  mineResult = null;

            try
            {
                dataset = new Dataset(
                    minerParams.DatasetFileName,
                    minerParams.InputContainsColumnHeaders,
                    minerParams.InputContainsRowHeaders);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Failed to load dataset: " + ex.Message, "Exception",
                                MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }

            if (dataset != null)
            {
                try
                {
                    if (minerParams.Algorithm == Algorithm.WithErrors)
                    {
                        parameter1 = minerParams.MaxErrors;
                    }
                    else if (minerParams.Algorithm == Algorithm.Groups)
                    {
                        parameter1 = minerParams.MinGroups;
                    }
                    else if (minerParams.Algorithm == Algorithm.Layers)
                    {
                        parameter1 = minerParams.MaxLayerDiff;
                    }

                    OPSM.DualCompare dualCompare = null;
                    int dualSupport = -1;
                    if (minerParams.Algorithm == Algorithm.OPSM)
                    {
                        dualSupport = minerParams.MinSupport;
                    }

                    if (minerParams.InCoreDualCompare == true)
                    {
                        dualCompare = new DualCompare(dataset, dualSupport);
                    }
                    OPSM.Miner dfsMiner = null;

                    if (minerParams.Algorithm == Algorithm.OPSM)
                    {
                        dfsMiner = new DFSLookAheadMiner(dataset, dualCompare);
                    }
                    else if (minerParams.Algorithm == Algorithm.TreePattern)
                    {
                        dfsMiner = new DFSPatternMiner(dataset, dualCompare);
                    }
                    else if (minerParams.Algorithm == Algorithm.WithErrors)
                    {
                        dfsMiner = new DFSErrorMiner(dataset, dualCompare);
                    }
                    else if (minerParams.Algorithm == Algorithm.Groups)
                    {
                        dfsMiner = new DFSGroupsMiner(dataset, dualCompare);
                    }
                    else if (minerParams.Algorithm == Algorithm.Layers)
                    {
                        dfsMiner = new DFSLayerMiner(dataset, dualCompare, minerParams.DatasetFileName);
                    }

                    string targetDirectory = minerParams.OutputDirectory;

                    mineResult = new MineResults(
                        15,
                        targetDirectory,
                        minerParams.WriteAllResults && minerParams.WriteOutputFiles);

                    dfsMiner.Mine(minerParams.MinSupport, minerParams.MinLength, minerParams.MaxLength, parameter1, mineResult);

                    if (mineResult != null)
                    {
                        mineResult.WriteResults(dataset);
                    }
                }
                catch (Exception ex)
                {
                    mineResult = null;
                    MessageBox.Show("Exception during mining: " + ex.ToString(), "Exception",
                                    MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }

            return(mineResult);
        }