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(); }
public int CreateFPTreeAndGenerateFrequentItemsets( IInputDatabaseHelper _inputHelper, IOutputDatabaseHelper _outHelper, float minSup) { outputDatabaseHelper = _outHelper; var watch = System.Diagnostics.Stopwatch.StartNew(); FPTree _fpTree = new FPTree(_inputHelper, minSup); fpTree = _fpTree; int totalFrequentItemSets = GenerateFrequentItemSets(); watch.Stop(); outputDatabaseHelper.WriteAggregatedResult(minSup, totalFrequentItemSets, (double)watch.ElapsedMilliseconds); return(totalFrequentItemSets); }
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(); }
public AprioriAlgorithm(IInputDatabaseHelper _inDatabaseHelper, IOutputDatabaseHelper _outDatabaseHelper, int _minimumSupportCount) : this(_inDatabaseHelper, _outDatabaseHelper) { MinimumSupportCount = _minimumSupportCount; }
//constructor public AprioriAlgorithm(IInputDatabaseHelper _inDatabaseHelper, IOutputDatabaseHelper _outDatabaseHelper) { inputDatabaseHelper = _inDatabaseHelper; outputDatabaseHelper = _outDatabaseHelper; MinimumSupport = 0f; }