get_features: Computes event-features

View source: R/event_functions_2d.R

get_featuresR Documentation

Computes event-features

Description

This function computes event features of 2D events.

Usage

get_features(
  dat.xyz,
  res.cluster,
  normal.stats.splines,
  win_size = 200,
  tt = 10
)

Arguments

dat.xyz

The data in a cluster friendly format. The first two columns have y and x positions with the third column having the pixel value of that position.

res.cluster

Cluster details from dbscan.

normal.stats.splines

The background statistics, output from spline_stats.

win_size

The window length of the moving window model, default is set to 200.

tt

Related to event ages. For example if tt=10 then the event ages are 10, 20, 30 and 40.

Value

An Nx22x4 array is returned for 2D data streams and an Nx13x4 array for 3D data streams. Here N is the total number of events extracted from all windows. The second dimension has m features and the class label for the supervised setting. The third dimension has 4 different event ages : tt, 2tt, 3tt, 4tt. For example, the element at [10,6,3] has the 6th feature, of the 10th extracted event when the age of the event is 3tt. The features for 2D streams are listed below. For 3D streams the features cluster_id, pixels, length, width, height, total_value, l2w_ratio, centroid_x, centroid_y, centroid_z, mean, std_dev and sd_from_global_mean are computed.

cluster_id

An identification number for each event.

pixels

The number of pixels of each event.

length

The length of the event.

width

The width of the event.

total_value

The total value of the pixels.

l2w_ratio

Length to width ratio of event.

centroid_x

x coordinate of event centroid.

centroid_y

y coordinate of event centroid.

mean

Mean value of event pixels.

std_dev

Standard deviation of event pixels.

avg_slope

The slope of an lm object fitted to the event pixels.

quad_1

The linear coefficient of a second order polynomial fitted to event pixels using lm.

quad_2

The quadratic coefficient of a second order polynomial fitted to event pixels using lm.

2sd_from_mean

The proportion of event pixels/cells that has values greater than 2 global standard deviations from the global mean of the window.

3sd_from_mean

The proportion of event pixels/cells that has values greater than 3 global standard deviations from the global mean of the window.

4sd_from_mean

The proportion of event pixels/cells that has values greater than 4 global standard deviations from the global mean of the window.

5iqr_from_median

A small portion of each window and its column medians and column IQRs are used to construct two smoothing splines: a median spline and an IQR spline. The value of the median smoothing spline at each event centroid is used as the local median for that event. Similarly, the value of the IQR smoothing spline at each event centroid is used as the local IQR for that event. This feature gives the proportion of event pixels/cells that has values greater than 5 local IQRs from the local median.

6iqr_from_median

The proportion of event pixels/cells that has values greater than 6 local IQRs from the local median computed using splines.

7iqr_from_median

The proportion of event pixels/cells that has values greater than 7 local IQRs from the local median computed using splines.

8iqr_from_median

The proportion of event pixels/cells that has values greater than 8 local IQRs from the local median computed using splines.

iqr_from_median

Let us denote the 75th percentile of the event pixels value by x. How many local IQRs is x is away from the local median? Both local IQR and local median are computed using splines. That value is given by this feature.

sd_from_mean

Let us denote the 80th percentile of the event pixels value by x. How many global standard deviations is x is away from the global mean? Here both global values are computed from window data.

Examples

out <- gen_stream(1, sd=15)
zz <- as.matrix(out$data)
clst <- get_clusters(zz, vis=TRUE)
sstats <- spline_stats(zz[1:100,])
ftrs <- get_features(clst$data, clst$clusters$cluster, sstats)

eventstream documentation built on May 16, 2022, 9:06 a.m.