Example #1
0
        public FPTree(IInputDatabaseHelper inDatabaseHelper, float minSup)
            : this()
        {
            minimumSupport      = minSup;
            inputDatabaseHelper = inDatabaseHelper;

            float temp = minimumSupport * inputDatabaseHelper.TotalTransactionNumber;

            minimumSupportCount = (int)temp;
            if (temp % 1 != 0)
            {
                minimumSupportCount++;
            }

            CalculateFrequentItems();
            frequentItems = frequentItems.OrderByDescending(x => x.SupportCount).ToList();// Xong B1.1

            inputDatabaseHelper.OpenDatabaseConnection();
            List <string> aTransaction = new List <string>();

            do
            {
                aTransaction = inputDatabaseHelper.GetNextTransaction();
                if (aTransaction.Exists(x => x != "y" && x != "?"))
                {
                    continue;
                }
                InsertTransaction(aTransaction);
            }while (aTransaction.Count > 0);
            inputDatabaseHelper.CloseDatabaseConnection();
        }
Example #2
0
        public FPTree(IInputDatabaseHelper inDatabaseHelper, float minSup)
            : this()
        {
            minimumSupport      = minSup;
            inputDatabaseHelper = inDatabaseHelper;

            minimumSupportCount = (int)(minimumSupport * (float)inputDatabaseHelper.TotalTransactionNumber);

            CalculateFrequentItems();
            frequentItems = frequentItems.OrderByDescending(x => x.SupportCount).ToList();

            inputDatabaseHelper.OpenDatabaseConnection();
            List <string> aTransaction = new List <string>();

            do
            {
                aTransaction = inputDatabaseHelper.GetNextTransaction();
                InsertTransaction(aTransaction);
            }while (aTransaction.Count > 0);
            inputDatabaseHelper.CloseDatabaseConnection();
        }