gen_stream: Generates a two dimensional data stream containing events of...

View source: R/gen_stream.R

gen_streamR Documentation

Generates a two dimensional data stream containing events of two classes.

Description

This function generates a two-dimensional data stream containing events of two classes. The data stream can be saved as separate files with images by specifying the argument folder.

Usage

gen_stream(
  n,
  folder = NULL,
  sd = 1,
  vis = FALSE,
  muAB = c(4, 3),
  sdAB = c(2, 3)
)

Arguments

n

The number of files to generate. Each file consists of a 350x250 data matrix.

folder

If this is set to a local folder, the data matrices are saved in folder/data, the images are saved in folder/pics and the event details are saved in folder/summary. The event details are needed to obtain the class labels of events, when event extraction is done.

sd

This specifies the seed.

vis

If TRUE, the images are plotted.

muAB

The starting event pixels of class A and B events are normally distributed with mean values specified by muAB. The default is c(4,3).

sdAB

The starting standard deviations of class A and B events. Default set to c(2,3).

Details

There are events of two classes in the data matrices : A and B. Events of class A have only one shape while events of class B have three different shapes, including class A's shape. This was motivated from a real world example. The details of events of each class are given below.

Feature class A class B
Starting cell/pixel values N(4,2) N(3,3)
Ending cell/pixel values N(8,2) N(5,3)
Maximum age of event - shape 1 U(20,30) U(20,30)
Maximum age of event - shape 2 NA U(100,150)
Maximum age of event - shape 3 NA U(100,150)
Maximum width of event - shape 1 U(20,26) U(20,26)
Maximum width of event - shape 2 NA U(30,38)
Maximum width of event - shape 3 NA U(50,58)

Value

A list with following components:

data

The data stream returned as a data frame.

details

A data frame containing the details of the events: their positions, class labels, etc.. . This is needed for identifying class labels of events during event extraction.

eventlabs

A matrix with 1 at event locations and 0 elsewhere.

See Also

stream_from_files.

Examples

out <- gen_stream(1, sd=15)
zz <- as.matrix(out$data)
image(1:nrow(zz), 1:ncol(zz),zz, xlab="Time", ylab="Location")


sevvandi/eventstream documentation built on May 16, 2022, 11:23 a.m.