This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def tuple_filter(tupl): | |
| count = 0 | |
| for transaction in transactions: | |
| if all(e in transaction for e in tupl): | |
| count += 1 | |
| if count >= threshold_count: | |
| return True |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sample.interval=20000 | |
| "readLines" "strsplit" "is.vector" "lapply" "eval.with.vis" "eval.with.vis" "source" | |
| "readLines" "strsplit" "is.vector" "lapply" "eval.with.vis" "eval.with.vis" "source" | |
| "readLines" "strsplit" "is.vector" "lapply" "eval.with.vis" "eval.with.vis" "source" | |
| "readLines" "strsplit" "is.vector" "lapply" "eval.with.vis" "eval.with.vis" "source" | |
| "readLines" "strsplit" "is.vector" "lapply" "eval.with.vis" "eval.with.vis" "source" | |
| "readLines" "strsplit" "is.vector" "lapply" "eval.with.vis" "eval.with.vis" "source" | |
| "strsplit" "is.vector" "lapply" "eval.with.vis" "eval.with.vis" "source" | |
| "strsplit" "is.vector" "lapply" "eval.with.vis" "eval.with.vis" "source" | |
| "strsplit" "is.vector" "lapply" "eval.with.vis" "eval.with.vis" "source" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Rprof() | |
| # Read a list of about about 100K vectors, each with fewer than 30 items | |
| # (most with a few). These are supermarket-type transactions. | |
| transactions = lapply(strsplit(readLines('Data/retail.dat'), ' '), as.numeric) | |
| transactions.unlisted = unlist(transactions) | |
| # Count the total number of items over all transactions. | |
| nitems = length(transactions.unlisted) | |
| # And the number of occurrences of each item. | |
| counts = table(transactions.unlisted) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def bcd_to_int(bcd_int): | |
| '''Convert a BCD integer to a base-10 integer.''' | |
| bcd_str = bin(bcd_int)[2:][::-1] | |
| num_groups = ((len(bcd_str) - 1) / 4) + 1 | |
| total = 0 | |
| for i in range(num_groups): | |
| digit = bcd_str[(4 * i):(4 * (i + 1))][::-1] | |
| total += int(digit, 2) * (10 ** i) |
OlderNewer