public void SolveTest() { //Arrange IApriori target = new Apriori(); //Act Output actual = target.Solve(minSupport, minConfidence, items, transactions); //Assert Assert.AreEqual(9, actual.FrequentItems.Count); Assert.AreEqual(2, actual.FrequentItems["a"].Support); Assert.AreEqual(3, actual.FrequentItems["b"].Support); Assert.AreEqual(3, actual.FrequentItems["c"].Support); Assert.AreEqual(3, actual.FrequentItems["e"].Support); Assert.AreEqual(2, actual.FrequentItems["ac"].Support); Assert.AreEqual(2, actual.FrequentItems["bc"].Support); Assert.AreEqual(3, actual.FrequentItems["be"].Support); Assert.AreEqual(2, actual.FrequentItems["ce"].Support); Assert.AreEqual(2, actual.FrequentItems["bce"].Support); Assert.AreEqual(4, actual.ClosedItemSets.Count, "ClosedItemSets calculation is wrong"); Assert.IsTrue(actual.ClosedItemSets.ContainsKey("c")); Assert.IsTrue(actual.ClosedItemSets.ContainsKey("be")); Assert.IsTrue(actual.ClosedItemSets.ContainsKey("ac")); Assert.IsTrue(actual.ClosedItemSets.ContainsKey("bce")); Assert.AreEqual(2, actual.MaximalItemSets.Count); Assert.AreEqual("ac", actual.MaximalItemSets[0]); Assert.AreEqual("bce", actual.MaximalItemSets[1]); Assert.AreEqual(5, actual.StrongRules.Count); }
private void btn_Solve_Click(object sender, EventArgs e) { #region validation if (!ValidateInput(txt_Support, true) || !ValidateInput(txt_Confidence, true)) { return; } if (lv_Transactions.Items.Count <= 0) { MessageBox.Show("Enter Transactions first", "Apriori", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } #endregion IApriori Apriori = new Apriori(); double minSupport = double.Parse(txt_Support.Text) / 100; double minConfidence = double.Parse(txt_Confidence.Text) / 100; IEnumerable<string> Items = GetItems(); var ourput = Apriori.Solve(minSupport, minConfidence, Items, transactions); frmOutput objfrmOutput = new frmOutput(ourput); objfrmOutput.ShowDialog(); }