|
|
20 // Number of Transactions 1, 2, gum, bread //transaction id, # of items purchased, item1, item2,... 2, 2, gum, napkin 3, 3, fruit, bread, fork 4, 7, milk, bread, napkin, fork, juice, soup, fruit 5, 4, juice, napkin, milk, bread 6, 2, bread, spoon 7, 1, juice 8, 3, juice, napkin, milk 9, 4, juice, napkin, milk, turkey 10, 1, pork 11, 10, milk, egg, bread, napkin, spoon, chicken, water, juice, soup, fork 12, 1, egg 13, 2, bread, milk, 14, 5, gum, salt, fruit, vegetable, bread 15, 1, bread 16, 2, bread, milk 17, 3, bread, salt, egg 18, 2, milk, napkin 19, 3, turkey, juice, milk 20, 3, turkey, chicken, soup ***Output*** unique items: pork vegetable water Items frequencies: bread:11 chicken:2 egg:3 fork:3 fruit:3 gum:3 juice:7 milk:9 napkin:7 pork:1 salt:2 soup:3 spoon:2 turkey:3 vegetable:1 water:1 Program ended with exit code: 0 |
|
|
Choose the threshold computation method 1. #(A,B)/A# or 2. (#(A,B)/#A)/#transactions Threshold: 0.30 banana----> apple, 0.30 napkin ----> apple, 0.45 bread -----> gum, 0.60 |
The instructions are compute the threshold value based on a given threshold computation method and value by the user. |
I have the amount of times each item was bought in the output but cant figure out the Threshold computation method. |
A= number of transactions with two same items B= number of transactions with one item The equation is = Threshold x (number of transactions having both two A,B items)/(number of transactions having A in their transaction ).. |
banana----> apple, 0.30 |
map<string,int>
to count frequencies and a map<pair<string,string>,int>
to count paired frequencies and came up with the following associations for your 20-item dataset.Unique items: pork vegetable water Item frequencies: bread: 11 chicken: 2 egg: 3 fork: 3 fruit: 3 gum: 3 juice: 7 milk: 9 napkin: 7 pork: 1 salt: 2 soup: 3 spoon: 2 turkey: 3 vegetable: 1 water: 1 Threshold: 0.3 fork ------> water, 0.33 turkey ------> chicken, 0.33 egg ------> fork, 0.33 fork ------> egg, 0.33 egg ------> juice, 0.33 egg ------> napkin, 0.33 egg ------> salt, 0.33 egg ------> soup, 0.33 soup ------> egg, 0.33 egg ------> spoon, 0.33 egg ------> water, 0.33 gum ------> vegetable, 0.33 fork ------> spoon, 0.33 egg ------> milk, 0.33 fruit ------> gum, 0.33 gum ------> fruit, 0.33 fruit ------> juice, 0.33 fruit ------> milk, 0.33 fruit ------> napkin, 0.33 fruit ------> salt, 0.33 fruit ------> soup, 0.33 soup ------> fruit, 0.33 fruit ------> vegetable, 0.33 gum ------> salt, 0.33 gum ------> napkin, 0.33 soup ------> water, 0.33 turkey ------> soup, 0.33 turkey ------> napkin, 0.33 soup ------> turkey, 0.33 soup ------> spoon, 0.33 fork ------> chicken, 0.33 egg ------> chicken, 0.33 juice ------> bread, 0.43 napkin ------> bread, 0.43 bread ------> milk, 0.45 spoon ------> soup, 0.50 chicken ------> turkey, 0.50 chicken ------> egg, 0.50 spoon ------> fork, 0.50 salt ------> vegetable, 0.50 salt ------> gum, 0.50 spoon ------> juice, 0.50 salt ------> fruit, 0.50 spoon ------> water, 0.50 chicken ------> bread, 0.50 chicken ------> milk, 0.50 spoon ------> chicken, 0.50 chicken ------> water, 0.50 chicken ------> spoon, 0.50 spoon ------> napkin, 0.50 chicken ------> napkin, 0.50 salt ------> egg, 0.50 chicken ------> juice, 0.50 chicken ------> fork, 0.50 spoon ------> egg, 0.50 spoon ------> milk, 0.50 milk ------> bread, 0.56 turkey ------> juice, 0.67 egg ------> bread, 0.67 soup ------> milk, 0.67 soup ------> napkin, 0.67 milk ------> napkin, 0.67 turkey ------> milk, 0.67 milk ------> juice, 0.67 soup ------> juice, 0.67 fork ------> napkin, 0.67 gum ------> bread, 0.67 soup ------> chicken, 0.67 fork ------> fruit, 0.67 fruit ------> fork, 0.67 soup ------> bread, 0.67 fork ------> juice, 0.67 fork ------> milk, 0.67 fork ------> soup, 0.67 soup ------> fork, 0.67 napkin ------> juice, 0.71 juice ------> napkin, 0.71 juice ------> milk, 0.86 napkin ------> milk, 0.86 water ------> soup, 1.00 spoon ------> bread, 1.00 vegetable ------> salt, 1.00 salt ------> bread, 1.00 fruit ------> bread, 1.00 water ------> chicken, 1.00 fork ------> bread, 1.00 water ------> spoon, 1.00 vegetable ------> bread, 1.00 water ------> napkin, 1.00 water ------> bread, 1.00 chicken ------> soup, 1.00 water ------> milk, 1.00 vegetable ------> fruit, 1.00 water ------> egg, 1.00 water ------> juice, 1.00 vegetable ------> gum, 1.00 water ------> fork, 1.00 |
map<pair<string,string>,int>
|
|
|
|
|
|
|
|
|
|