Random Transaction Data Stream Generator

Description

A datastream generator that produces random transactions within a specified range.

Usage

1
2
3
DSD_Transactions_Random(type=c("integer"), setSize=50, maxTransactionSize=10, 
                                    prob = function(set) rep(1/set, times=set),
                                    size = function(maxSize) sample(1:maxSize, 1) )

Arguments

type

The type of transaction data to produce. Currently integer is the only option

setSize

The size of the set to create transactions from

maxTransactionSize

The maximum size for any one transaction

prob

function describing the probability for each item in the itemset

size

function describing the probably size of any individual transaction

Details

DSD_Transactions_Random creates a DSD that generates random transactions with a specified set size and max transaction size. It allows for the use of custom functions for the probability of each number in that range, and the probable length of each transaction.

Value

Returns a DSD_Transactions_Random object (subclass of DSD_Transactions, DSD) which is a list of the defined params. The params are either passed in from the function or created internally

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
#create random transaction datastream
dsd <- DSD_Transactions_Random()

#create with a set size of 50 and a max transaction size of 10
dsd <- DSD_Transactions_Random(setSize=50, maxTransactionSize=10)

#create with custom size function
dsd <- DSD_Transactions_Random(setSize= 50, maxTransactionSize= 10 , size=function(max) rexp(max))

#get a transaction from the datastream
transaction <- get_points(dsd)

transaction