public void ShouldMatchExpectedSupport(string item0, string item1, int expected) { var transactions = new TestTransactionsLoader().Load(); var result = transactions.Support(ImmutableHashSet.Create(item0, item1)); result.Should().Be(expected); }
public void ShouldGenerateCandidates() { var transactions = new TestTransactionsLoader().Load().ToImmutableArray(); var result = transactions.ExtractItems(); Console.WriteLine(result.Format()); result.Count().Should().Be(5); }
public void ShouldExtractFeatures() { var transactions = new TestTransactionsLoader().Load(); var features = transactions.ExtractFeatures().ToImmutableArray(); features.Select(set => set.Format()).ForEach(line => Console.WriteLine(line)); features.Count().Should().Be(5); }
public void ShouldReturnProbabilityOfTwoItems(string item0, string item1, float expected) { var transactions = new TestTransactionsLoader().Load().ToImmutableArray(); var frequency = transactions.Frequency(new HashSet <string> { item0, item1 }); frequency.Should().Be(expected); }
public void ShouldFilterByFrequency(float minFrequency, int expected) { var transactions = new TestTransactionsLoader().Load().ToImmutableArray(); var features = transactions.ExtractFeatures(); var table = transactions.CalculateFrequencyTable(features); var result = table.FilterByFrequency(minFrequency).ToImmutableArray(); result.Select(set => set.Format()).ForEach(line => Console.WriteLine(line)); result.Count().Should().Be(expected); }
public void ShouldCalculateConfidence(string item0, string item1, float expected) { var transactions = new TestTransactionsLoader().Load().ToImmutableArray(); var result = transactions.Confidence(new HashSet <string> { item0 }, new HashSet <string> { item1 }); result.Should().Be(expected); }
public void ShouldFilterByConfidence() { var transactions = new TestTransactionsLoader().Load().ToImmutableArray(); var features = transactions.ExtractFeatures(); var result = transactions .GenerateCandidates(features, minConfidence: 1f); result.Select(set => set.Format()).ForEach(line => Console.WriteLine(line)); result.Count().Should().Be(2); }
public void ShouldReturnTheCorrectTable() { var transactions = new TestTransactionsLoader().Load().ToImmutableArray(); var items = transactions.ExtractFeatures(); var result = transactions.CalculateFrequencyTable(items).ToImmutableArray(); foreach (var line in result) { Console.WriteLine("item: {0}, support: {1}, frequency: {2}", line.Item.Format(), line.Support, line.Frequency); } }