Example #1
0
 /// <summary>
 /// Createa new association rule and calculate its confidence and lift metrics on the given data set.
 /// </summary>
 /// <param name="ante">The binarized element X, of X -> Y</param>
 /// <param name="anteSize">The size of X</param>
 /// <param name="conq">The binarized element Y, of X -> Y</param>
 /// <param name="conqSize">The size of Y</param>
 /// <param name="DataSet">The data set to use to calculate metrics.</param>
 public AssociationRule(uint ante, int anteSize, uint conq, int conqSize, CompactDataSet DataSet)
 {
     Antecedant = ante;
     Consequent = conq;
     Confidence = DataSet.calcConfidence(ante, anteSize, conq, conqSize);
     Lift = DataSet.calcInterest(ante, anteSize, conq, conqSize);
 }
Example #2
0
        private static void Apriori(DataSet data)
        {
            Stopwatch stopwatch = new Stopwatch();
            stopwatch.Start();
            bool verbose = true;
            var cData = new CompactDataSet(data) { Verbose = verbose };
            var miner = new AprioriMiner(cData) { MinSupport = 0.01, MinConfidence = 0.3, Verbose = verbose };
            cData.printInfo();
            miner.mine();
            stopwatch.Stop();
            TimeSpan ts = stopwatch.Elapsed;

            //Format and display the TimeSpan value.
            string elapsedTime = String.Format("{0:00}:{1:00}:{2:00}.{3:00}",
                ts.Hours, ts.Minutes, ts.Seconds,
                ts.Milliseconds / 10);
            Console.WriteLine("Apriori RunTime: " + elapsedTime);
        }
Example #3
0
 /// <summary>
 /// Create a new Apriori Miner
 /// </summary>
 /// <param name="DataSet">The data set to mine.</param>
 public AprioriMiner(CompactDataSet DataSet)
 {
     this.DataSet = DataSet;
 }