public void Apriori_Big() { var csvFilePath = @"..\..\..\..\..\data\csv\big-text-1.csv"; var dataFields = DataFields.ReadFromCsv(csvFilePath); var myApriori = new Apriori(dataFields); myApriori.CalculateCNodes(0.003f); myApriori.Rules.Count.ShouldBeGreaterThan(0); _testOutputHelper.WriteLine("Top rules ordered by Confidence (Up to 10)"); foreach (var associationRule in myApriori.Rules.OrderByDescending(x => x.Confidence).Take(10)) { _testOutputHelper.WriteLine(associationRule.ToDetailedString(dataFields)); } }
public void Apriori_Market_Basket_One() { var dataFields = DataFields.ReadFromCsv(@"..\..\..\..\..\data\csv\small-market-basket.csv"); var myApriori = new Apriori(dataFields); myApriori.CalculateCNodes(.4f); myApriori.Rules.ShouldNotBeNull(); myApriori.Rules.Count.ShouldNotBe(0); myApriori.Rules.Count(x => x.Confidence >= .7f).ShouldBe(12); _testOutputHelper.WriteLine("Top rules ordered by Confidence (Up to 10)"); foreach (var associationRule in myApriori.Rules.OrderByDescending(x => x.Confidence).Take(10)) { _testOutputHelper.WriteLine(associationRule.ToDetailedString(dataFields)); } }