This function extracts events from a 2D or 3D data stream and computes a set of 30 features for 2D streams and 13 features for 3D streams, by using a moving window. 2D data streams with class labels can be generated by using the function gen_stream. To get the class labels of the extracted events for the supervised setting, the event position is matched with the details of the events, which is part of the output of the gen_stream function.

extract_event_ftrs(
  stream,
  supervised = FALSE,
  details = NULL,
  win_size = 200,
  step_size = 20,
  thres = 0.95,
  folder = NULL,
  vis = FALSE,
  tt = 10,
  epsilon = 5,
  miniPts = 10,
  rolling = TRUE
)

Arguments

stream

A data stream. This can be the output of either the gen_stream function or the stream_from_files function.

supervised

If TRUE, event class labels need to be given in details.

details

Event details. This is also an output of the gen_stream function. Event details are used to get the class labels of the extracted events, by matching the position.

win_size

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

step_size

The window is moved by the step_size, default is 20.

thres

The cut-off quantile. Default is set to 0.95. Values greater than the quantile will be clustered. The rest is not clustered.

folder

If set to a local folder, this is where the jpegs of window data and extracted events are saved for a 2D data stream.

vis

If TRUE, the window data and the extracted events are plotted for a 2D data stream.

tt

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

epsilon

The eps parameter in dbscan function in the package dbscan

miniPts

The minPts parameter in dbscan function in the package dbscan

rolling

This parameter is set to TRUE if rolling windows are considered.

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

# 2D data stream example
out <- gen_stream(1, sd=15)
zz <- as.matrix(out$data)
features <- extract_event_ftrs(zz, supervised=TRUE, details = out$details)
features
#> , , 1
#> 
#>       cluster_id pixels length width total_value l2w_ratio centroid_x
#>  [1,]          1     37     16    10    183.3779       1.6   33.56757
#>  [2,]          2     59     15    10    280.4103       1.5   49.49153
#>  [3,]          3     61     22    10    284.1976       2.2  200.47541
#>  [4,]          1     36     16    10    181.3300       1.6   33.75000
#>  [5,]          3     60     22    10    282.1391       2.2  200.33333
#>  [6,]          1     37     16    10    183.3779       1.6   33.56757
#>  [7,]          3     61     22    10    284.1976       2.2  200.47541
#>  [8,]          1     38     16    10    185.3756       1.6   33.57895
#>  [9,]          2     61     22    10    284.1976       2.2  200.47541
#> [10,]          1     38     16    10    185.3756       1.6   33.57895
#> [11,]          1     38     16    10    185.3756       1.6   33.57895
#> [12,]          3     59     19    10    268.4860       1.9  216.08475
#> [13,]          1     38     16    10    185.3756       1.6   33.57895
#> [14,]          3     60     19    10    270.4541       1.9  216.10000
#> [15,]          1     38     16    10    185.3756       1.6   33.57895
#> [16,]          3     63     23    10    276.2645       2.3  216.20635
#>       centroid_y     mean  std_dev   avg_slope    quad_1     quad_2
#>  [1,]  179.48649 4.956161 2.079082  0.06080882  1.121259  1.5355043
#>  [2,]   30.30508 4.752717 1.442758  0.09630952  1.611567  2.0044179
#>  [3,]   83.95082 4.658977 1.726299 -0.06479737 -1.720489 -5.5349682
#>  [4,]  159.47222 5.036943 2.048836  0.10860294  2.002539  0.8408557
#>  [5,]   64.01667 4.702318 1.707071 -0.02485216 -0.623263 -4.9002591
#>  [6,]  139.48649 4.956161 2.079082  0.06080882  1.121259  1.5355043
#>  [7,]   43.95082 4.658977 1.726299 -0.06479737 -1.720489 -5.5349682
#>  [8,]  119.47368 4.878304 2.106205  0.06105392  1.125779  1.4891944
#>  [9,]   23.95082 4.658977 1.726299 -0.06479737 -1.720489 -5.5349682
#> [10,]   99.47368 4.878304 2.106205  0.06105392  1.125779  1.4891944
#> [11,]   79.47368 4.878304 2.106205  0.06105392  1.125779  1.4891944
#> [12,]  192.05085 4.550611 1.954643 -0.16689568 -3.310419  2.8690624
#> [13,]   59.47368 4.878304 2.106205  0.06105392  1.125779  1.4891944
#> [14,]  172.00000 4.507568 1.966478 -0.16796796 -3.331688  2.9153940
#> [15,]   39.47368 4.878304 2.106205  0.06105392  1.125779  1.4891944
#> [16,]  151.92063 4.385150 1.996117 -0.16889710 -3.858846  1.8319275
#>       2sd_from_mean 3sd_from_mean 4sd_from_mean 5iqr_from_median
#>  [1,]     0.8648649     0.7027027     0.5135135       0.08108108
#>  [2,]     0.8983051     0.7627119     0.5423729       0.00000000
#>  [3,]     0.9016393     0.6721311     0.4590164       0.13114754
#>  [4,]     0.8333333     0.5555556     0.4166667       0.02777778
#>  [5,]     0.8333333     0.5833333     0.3166667       0.11666667
#>  [6,]     0.8648649     0.6756757     0.4864865       0.21621622
#>  [7,]     0.9016393     0.6721311     0.4590164       0.11475410
#>  [8,]     0.8421053     0.6842105     0.5000000       0.23684211
#>  [9,]     0.9016393     0.6721311     0.4590164       0.00000000
#> [10,]     0.7894737     0.5263158     0.3947368       0.21052632
#> [11,]     0.7894737     0.5263158     0.3684211       0.21052632
#> [12,]     0.7118644     0.5084746     0.3050847       0.01694915
#> [13,]     0.7368421     0.5000000     0.3157895       0.18421053
#> [14,]     0.6833333     0.4500000     0.2833333       0.00000000
#> [15,]     0.7105263     0.4736842     0.2368421       0.18421053
#> [16,]     0.6349206     0.4126984     0.1746032       0.00000000
#>       6iqr_from_median 7iqr_from_median 8iqr_from_median iqr_from_median
#>  [1,]       0.02702703       0.00000000                0        3.855885
#>  [2,]       0.00000000       0.00000000                0        2.421684
#>  [3,]       0.03278689       0.01639344                0        4.425198
#>  [4,]       0.00000000       0.00000000                0        3.341198
#>  [5,]       0.03333333       0.01666667                0        4.313005
#>  [6,]       0.08108108       0.02702703                0        4.811563
#>  [7,]       0.03278689       0.01639344                0        4.333460
#>  [8,]       0.10526316       0.02631579                0        4.945289
#>  [9,]       0.00000000       0.00000000                0        2.688216
#> [10,]       0.07894737       0.02631579                0        4.770118
#> [11,]       0.07894737       0.02631579                0        4.857381
#> [12,]       0.00000000       0.00000000                0        3.339955
#> [13,]       0.07894737       0.02631579                0        4.579405
#> [14,]       0.00000000       0.00000000                0        2.808292
#> [15,]       0.07894737       0.02631579                0        4.533396
#> [16,]       0.00000000       0.00000000                0        2.708738
#>       sd_from_global_mean Class
#>  [1,]            5.648562     0
#>  [2,]            5.216775     1
#>  [3,]            5.096371     0
#>  [4,]            4.932792     0
#>  [5,]            4.404409     0
#>  [6,]            5.537365     0
#>  [7,]            4.997283     0
#>  [8,]            5.608588     0
#>  [9,]            5.116656     0
#> [10,]            4.825159     0
#> [11,]            4.700423     0
#> [12,]            4.438933     0
#> [13,]            4.457583     0
#> [14,]            4.197708     0
#> [15,]            4.175066     0
#> [16,]            3.904362     0
#> 
#> , , 2
#> 
#>       cluster_id pixels length width total_value l2w_ratio centroid_x
#>  [1,]          1    108     21    20    541.6973  1.050000   34.50926
#>  [2,]          2    168     17    20    941.9876  0.850000   49.79762
#>  [3,]          3    143     22    20    662.8071  1.100000  200.50350
#>  [4,]          1    107     21    20    539.6493  1.050000   34.57944
#>  [5,]          3    139     22    20    654.6504  1.100000  200.41007
#>  [6,]          1    108     21    20    541.6973  1.050000   34.50926
#>  [7,]          3    143     22    20    662.8071  1.100000  200.50350
#>  [8,]          1    109     21    20    543.6949  1.050000   34.50459
#>  [9,]          2    143     22    20    662.8071  1.100000  200.50350
#> [10,]          1    109     21    20    543.6949  1.050000   34.50459
#> [11,]          1    110     21    20    545.6786  1.050000   34.42727
#> [12,]          3     85     19    14    402.8697  1.357143  216.04706
#> [13,]          1    110     21    20    545.6786  1.050000   34.42727
#> [14,]          3    127     23    20    611.8245  1.150000  216.29921
#> [15,]          1    111     21    20    547.6134  1.050000   34.43243
#> [16,]          3    131     23    20    619.5690  1.150000  216.35115
#>       centroid_y     mean  std_dev   avg_slope    quad_1      quad_2
#>  [1,]  184.72222 5.015715 1.917244  0.41199278  9.609240  0.62048193
#>  [2,]   35.67857 5.607069 1.939474  0.19850540  3.745064  4.41364026
#>  [3,]   89.21678 4.635015 1.925628 -0.10730131 -3.017729 -8.55573222
#>  [4,]  164.76636 5.043451 1.904373  0.44722563 10.431004 -0.07922287
#>  [5,]   69.20863 4.709715 1.901205 -0.07221529 -2.030974 -7.66435661
#>  [6,]  144.72222 5.015715 1.917244  0.41199278  9.609240  0.62048193
#>  [7,]   49.21678 4.635015 1.925628 -0.10730131 -3.017729 -8.55573222
#>  [8,]  124.66972 4.988026 1.930119  0.41279276  9.627899  0.76177047
#>  [9,]   29.21678 4.635015 1.925628 -0.10730131 -3.017729 -8.55573222
#> [10,]  104.66972 4.988026 1.930119  0.41279276  9.627899  0.76177047
#> [11,]   84.69091 4.960715 1.942481  0.36499864  8.513158  1.99325093
#> [12,]  193.92941 4.739644 2.227368 -0.13625636 -2.702680  0.21514681
#> [13,]   64.69091 4.960715 1.942481  0.36499864  8.513158  1.99325093
#> [14,]  177.07087 4.817516 2.281926  0.23237994  5.769599  5.55523682
#> [15,]   44.74775 4.933454 1.954846  0.36539352  8.522368  1.84655134
#> [16,]  156.94656 4.729534 2.301006  0.15455226  3.837270  3.37390474
#>       2sd_from_mean 3sd_from_mean 4sd_from_mean 5iqr_from_median
#>  [1,]     0.9259259     0.7222222     0.5277778      0.055555556
#>  [2,]     0.9464286     0.8511905     0.6547619      0.005952381
#>  [3,]     0.8881119     0.6293706     0.4195804      0.181818182
#>  [4,]     0.8878505     0.5887850     0.4112150      0.037383178
#>  [5,]     0.8345324     0.5395683     0.3021583      0.158273381
#>  [6,]     0.9259259     0.7129630     0.5092593      0.194444444
#>  [7,]     0.8881119     0.6083916     0.3986014      0.153846154
#>  [8,]     0.9174312     0.7155963     0.5229358      0.211009174
#>  [9,]     0.8881119     0.6293706     0.4195804      0.006993007
#> [10,]     0.8715596     0.5779817     0.4036697      0.192660550
#> [11,]     0.8545455     0.5727273     0.3454545      0.200000000
#> [12,]     0.7294118     0.4941176     0.3058824      0.047058824
#> [13,]     0.8090909     0.5363636     0.2636364      0.145454545
#> [14,]     0.7165354     0.4645669     0.2913386      0.015748031
#> [15,]     0.7657658     0.4954955     0.2072072      0.135135135
#> [16,]     0.6641221     0.4274809     0.2290076      0.015267176
#>       6iqr_from_median 7iqr_from_median 8iqr_from_median iqr_from_median
#>  [1,]      0.009259259       0.00000000      0.000000000        3.676004
#>  [2,]      0.000000000       0.00000000      0.000000000        2.868293
#>  [3,]      0.062937063       0.02097902      0.006993007        4.431416
#>  [4,]      0.000000000       0.00000000      0.000000000        3.141142
#>  [5,]      0.043165468       0.02158273      0.007194245        4.336104
#>  [6,]      0.064814815       0.03703704      0.000000000        4.690779
#>  [7,]      0.041958042       0.02097902      0.006993007        4.339350
#>  [8,]      0.082568807       0.03669725      0.009174312        4.847355
#>  [9,]      0.000000000       0.00000000      0.000000000        2.692249
#> [10,]      0.064220183       0.03669725      0.000000000        4.681272
#> [11,]      0.063636364       0.03636364      0.009090909        4.729170
#> [12,]      0.023529412       0.00000000      0.000000000        3.352369
#> [13,]      0.054545455       0.03636364      0.000000000        4.448749
#> [14,]      0.000000000       0.00000000      0.000000000        2.888270
#> [15,]      0.054054054       0.03603604      0.000000000        4.372450
#> [16,]      0.000000000       0.00000000      0.000000000        2.802021
#>       sd_from_global_mean Class
#>  [1,]            5.448264     0
#>  [2,]            5.851952     1
#>  [3,]            5.314207     0
#>  [4,]            4.718896     0
#>  [5,]            4.641578     0
#>  [6,]            5.341459     0
#>  [7,]            5.210342     0
#>  [8,]            5.452707     0
#>  [9,]            5.336044     0
#> [10,]            4.689473     0
#> [11,]            4.552219     0
#> [12,]            4.685819     0
#> [13,]            4.316763     0
#> [14,]            4.502564     0
#> [15,]            4.028951     0
#> [16,]            4.178036     0
#> 
#> , , 3
#> 
#>       cluster_id pixels length width total_value l2w_ratio centroid_x
#>  [1,]          1    175     21    28    905.9538 0.7500000   34.77143
#>  [2,]          2    214     21    27   1283.9096 0.7777778   49.82243
#>  [3,]          3    230     25    30   1103.8297 0.8333333  199.83913
#>  [4,]          1    178     21    30    933.9063 0.7000000   34.80899
#>  [5,]          3    224     25    30   1091.6033 0.8333333  199.79911
#>  [6,]          1    180     21    30    937.9922 0.7000000   34.77222
#>  [7,]          3    229     25    30   1101.8243 0.8333333  199.86463
#>  [8,]          1    181     21    30    939.9898 0.7000000   34.76796
#>  [9,]          2    230     25    30   1103.8297 0.8333333  199.83913
#> [10,]          1    181     21    30    939.9898 0.7000000   34.76796
#> [11,]          1    182     21    30    941.9736 0.7000000   34.71978
#> [12,]          3     85     19    14    402.8697 1.3571429  216.04706
#> [13,]          1    183     23    30    943.9425 0.7666667   34.66120
#> [14,]          3    211     23    30   1078.9145 0.7666667  216.45024
#> [15,]          1    184     23    30    945.8772 0.7666667   34.66304
#> [16,]          3    215     23    30   1086.6590 0.7666667  216.47907
#>       centroid_y     mean  std_dev  avg_slope     quad_1     quad_2
#>  [1,]  189.20571 5.176879 1.976714  0.4536933  10.581854 -6.1531110
#>  [2,]   37.84579 5.999578 2.208274 -0.1282088  -2.814072 10.8925901
#>  [3,]   94.55217 4.799260 2.013812 -0.3356108 -10.363011 -5.0421556
#>  [4,]  169.56180 5.246665 1.948217  0.4888621  11.402126 -7.4518985
#>  [5,]   74.57589 4.873229 1.988432 -0.2941425  -9.082549 -3.9701965
#>  [6,]  149.53889 5.211068 1.966354  0.4543452  10.597061 -6.8175977
#>  [7,]   54.52402 4.811460 2.009686 -0.3323418 -10.262069 -4.9984438
#>  [8,]  129.48066 5.193314 1.975378  0.4552143  10.617331 -6.6641078
#>  [9,]   34.55217 4.799260 2.013812 -0.3356108 -10.363011 -5.0421556
#> [10,]  109.48066 5.193314 1.975378  0.4552143  10.617331 -6.6641078
#> [11,]   89.46703 5.175679 1.984228  0.4074202   9.502590 -5.4326273
#> [12,]  193.92941 4.739644 2.227368 -0.1362564  -2.702680  0.2151468
#> [13,]   69.49727 5.158156 1.992917  0.2413005   6.160442  0.5377480
#> [14,]  182.75829 5.113339 2.320973  0.3487596   9.020325 -0.8121940
#> [15,]   49.50543 5.140637 2.001621  0.2413863   6.162632  0.5242852
#> [16,]  162.57674 5.054228 2.339103  0.2802139   7.247458 -2.8091457
#>       2sd_from_mean 3sd_from_mean 4sd_from_mean 5iqr_from_median
#>  [1,]     0.9428571     0.7314286     0.5657143      0.068571429
#>  [2,]     0.9485981     0.8598131     0.6962617      0.009345794
#>  [3,]     0.8913043     0.6695652     0.4434783      0.191304348
#>  [4,]     0.8988764     0.6292135     0.4438202      0.016853933
#>  [5,]     0.8392857     0.5937500     0.3080357      0.165178571
#>  [6,]     0.9333333     0.7333333     0.5666667      0.233333333
#>  [7,]     0.8951965     0.6593886     0.4235808      0.170305677
#>  [8,]     0.9392265     0.7403315     0.5745856      0.254143646
#>  [9,]     0.8913043     0.6695652     0.4434783      0.008695652
#> [10,]     0.8839779     0.6187845     0.4364641      0.232044199
#> [11,]     0.8736264     0.6153846     0.3846154      0.236263736
#> [12,]     0.7294118     0.4941176     0.3058824      0.047058824
#> [13,]     0.8306011     0.5846995     0.3169399      0.196721311
#> [14,]     0.7535545     0.5260664     0.3364929      0.023696682
#> [15,]     0.7826087     0.5543478     0.2500000      0.184782609
#> [16,]     0.7162791     0.4837209     0.2790698      0.018604651
#>       6iqr_from_median 7iqr_from_median 8iqr_from_median iqr_from_median
#>  [1,]       0.01142857       0.00000000      0.000000000        3.735735
#>  [2,]       0.00000000       0.00000000      0.000000000        3.208130
#>  [3,]       0.08695652       0.03913043      0.013043478        4.506284
#>  [4,]       0.00000000       0.00000000      0.000000000        3.197875
#>  [5,]       0.07142857       0.04017857      0.004464286        4.416744
#>  [6,]       0.08888889       0.03333333      0.000000000        4.827126
#>  [7,]       0.06986900       0.03930131      0.004366812        4.419719
#>  [8,]       0.10497238       0.03867403      0.011049724        5.008628
#>  [9,]       0.00000000       0.00000000      0.000000000        2.741086
#> [10,]       0.08839779       0.03314917      0.000000000        4.838559
#> [11,]       0.09340659       0.03296703      0.010989011        4.912924
#> [12,]       0.02352941       0.00000000      0.000000000        3.352369
#> [13,]       0.07650273       0.02732240      0.000000000        4.611791
#> [14,]       0.00000000       0.00000000      0.000000000        3.168817
#> [15,]       0.06521739       0.02717391      0.000000000        4.554401
#> [16,]       0.00000000       0.00000000      0.000000000        3.064317
#>       sd_from_global_mean Class
#>  [1,]            5.729361     0
#>  [2,]            6.506826     1
#>  [3,]            5.377321     0
#>  [4,]            5.034917     0
#>  [5,]            4.660514     0
#>  [6,]            5.693595     0
#>  [7,]            5.272369     0
#>  [8,]            5.822888     0
#>  [9,]            5.399608     0
#> [10,]            5.011696     0
#> [11,]            4.868097     0
#> [12,]            4.685819     0
#> [13,]            4.603014     0
#> [14,]            4.910284     0
#> [15,]            4.298551     0
#> [16,]            4.573272     0
#> 
#> , , 4
#> 
#>       cluster_id pixels length width total_value l2w_ratio centroid_x
#>  [1,]          1    165     21    27    848.4729 0.7777778   34.72727
#>  [2,]          2    213     17    25   1281.8273 0.6800000   49.87324
#>  [3,]          3   1065     29   121   5419.0785 0.2396694  199.97559
#>  [4,]          1    177     21    29    926.9383 0.7241379   34.81356
#>  [5,]          3   1251     29   141   6573.2877 0.2056738  199.99201
#>  [6,]          1    179     21    29    931.0242 0.7241379   34.77654
#>  [7,]          3   1272     29   142   6616.4101 0.2042254  199.96384
#>  [8,]          1    180     21    29    933.0218 0.7241379   34.77222
#>  [9,]          2   1277     29   142   6626.4702 0.2042254  199.93970
#> [10,]          1    180     21    29    933.0218 0.7241379   34.77222
#> [11,]          1    181     21    29    935.0056 0.7241379   34.72376
#> [12,]          3     81     19    13    380.5403 1.4615385  216.01235
#> [13,]          1    182     23    29    936.9745 0.7931034   34.66484
#> [14,]          3    215     23    32   1094.1840 0.7187500  216.40465
#> [15,]          1    184     23    30    945.8772 0.7666667   34.66304
#> [16,]          3    219     23    32   1101.9284 0.7187500  216.43379
#>       centroid_y     mean  std_dev  avg_slope    quad_1       quad_2
#>  [1,]  188.55152 5.142260 1.990118  0.4339769 10.121993 -4.839128212
#>  [2,]   37.78873 6.017969 2.196988  0.1858477  3.506259  3.259963441
#>  [3,]  142.49765 5.088337 2.202152  0.8577889 36.036966  3.411458873
#>  [4,]  169.49153 5.236940 1.949406  0.4896461 11.420411 -7.313439292
#>  [5,]  133.75140 5.254427 2.240238  0.8182996 35.488712 -0.008268052
#>  [6,]  149.46927 5.201252 1.967443  0.4551292 10.615346 -6.679138472
#>  [7,]  113.57862 5.201580 2.258817  0.5959960 25.847662  8.544109044
#>  [8,]  129.41111 5.183454 1.976417  0.4560032 10.635732 -6.524764385
#>  [9,]   93.47298 5.189092 2.263177  0.6671916 28.935333  5.675609227
#> [10,]  109.41111 5.183454 1.976417  0.4560032 10.635732 -6.524764385
#> [11,]   89.39779 5.165777 1.985217  0.4082091  9.520991 -5.293283927
#> [12,]  193.62963 4.698028 2.255406 -0.1606581 -3.186695  0.503404014
#> [13,]   69.42857 5.148212 1.993857  0.2414045  6.163096  0.676376407
#> [14,]  183.02791 5.089228 2.318326  0.3077255  7.959017 -0.793123111
#> [15,]   49.50543 5.140637 2.001621  0.2413863  6.162632  0.524285172
#> [16,]  162.84475 5.031637 2.335618  0.2391777  6.186095 -2.784319675
#>       2sd_from_mean 3sd_from_mean 4sd_from_mean 5iqr_from_median
#>  [1,]     0.9393939     0.7212121     0.5575758      0.066666667
#>  [2,]     0.9530516     0.8638498     0.6995305      0.009389671
#>  [3,]     0.9032864     0.6882629     0.4892019      0.258215962
#>  [4,]     0.8983051     0.6271186     0.4406780      0.016949153
#>  [5,]     0.8577138     0.6171063     0.4068745      0.257394085
#>  [6,]     0.9329609     0.7318436     0.5642458      0.229050279
#>  [7,]     0.9103774     0.6886792     0.4960692      0.257861635
#>  [8,]     0.9388889     0.7388889     0.5722222      0.250000000
#>  [9,]     0.9091621     0.6961629     0.5090055      0.021143305
#> [10,]     0.8833333     0.6166667     0.4333333      0.227777778
#> [11,]     0.8729282     0.6132597     0.3812155      0.232044199
#> [12,]     0.7160494     0.4691358     0.3086420      0.049382716
#> [13,]     0.8296703     0.5824176     0.3131868      0.192307692
#> [14,]     0.7488372     0.5255814     0.3302326      0.023255814
#> [15,]     0.7826087     0.5543478     0.2500000      0.184782609
#> [16,]     0.7123288     0.4840183     0.2739726      0.018264840
#>       6iqr_from_median 7iqr_from_median 8iqr_from_median iqr_from_median
#>  [1,]      0.012121212       0.00000000       0.00000000        3.723050
#>  [2,]      0.000000000       0.00000000       0.00000000        3.210489
#>  [3,]      0.127699531       0.05539906       0.01596244        5.073808
#>  [4,]      0.000000000       0.00000000       0.00000000        3.193906
#>  [5,]      0.116706635       0.05195843       0.01838529        5.026133
#>  [6,]      0.089385475       0.03351955       0.00000000        4.815507
#>  [7,]      0.122641509       0.05424528       0.01965409        5.061449
#>  [8,]      0.105555556       0.03888889       0.01111111        4.993319
#>  [9,]      0.002349256       0.00000000       0.00000000        3.164550
#> [10,]      0.088888889       0.03333333       0.00000000        4.823830
#> [11,]      0.093922652       0.03314917       0.01104972        4.897816
#> [12,]      0.024691358       0.00000000       0.00000000        3.346877
#> [13,]      0.076923077       0.02747253       0.00000000        4.597791
#> [14,]      0.000000000       0.00000000       0.00000000        3.128995
#> [15,]      0.065217391       0.02717391       0.00000000        4.554401
#> [16,]      0.000000000       0.00000000       0.00000000        3.028950
#>       sd_from_global_mean Class
#>  [1,]            5.729361     0
#>  [2,]            6.522669     1
#>  [3,]            5.890820     0
#>  [4,]            4.992176     0
#>  [5,]            5.212672     0
#>  [6,]            5.633081     0
#>  [7,]            5.892551     0
#>  [8,]            5.754156     0
#>  [9,]            6.032089     0
#> [10,]            4.951867     0
#> [11,]            4.809631     0
#> [12,]            4.681336     0
#> [13,]            4.551558     0
#> [14,]            4.881772     0
#> [15,]            4.298551     0
#> [16,]            4.506743     0
#> 

# 3D data stream example
set.seed(1)
arr <- array(rnorm(12000),dim=c(40,25,30))
arr[25:33,12:20, 20:23] <- 10
# getting events
ftrs <- extract_event_ftrs(arr, supervised=FALSE, win_size=10, step_size = 2, tt=2, thres=0.985)
ftrs
#> , , 1
#> 
#>       cluster_id pixels length width height total_value l2w_ratio centroid_x
#>  [1,]          2      3      2     5      4    7.026350 0.4000000   1.666667
#>  [2,]          3      2      2     3      1    4.619362 0.6666667   3.500000
#>  [3,]          3      7      2     9      6   16.329740 0.2222222   1.714286
#>  [4,]          2      2      2     4      2    4.443618 0.5000000   2.500000
#>  [5,]          4      6      2     9      7   17.318289 0.2222222   1.333333
#>  [6,]          6      7      2     9      6   16.329740 0.2222222   1.714286
#>  [7,]          5      2      2     4      2    4.443618 0.5000000   2.500000
#>  [8,]          1      2      2     5      6    4.803209 0.4000000   7.500000
#>  [9,]          1     72      2     9      4  720.000000 0.2222222   7.500000
#> [10,]          1     72      2     9      4  720.000000 0.2222222   5.500000
#>       centroid_y centroid_z      mean     std_dev        slope quad1 quad2
#>  [1,]   6.333333   17.33333  2.342117 0.066946507 -0.108070035     0     0
#>  [2,]   9.000000   27.00000  2.309681 0.049137050  0.069490283     0     0
#>  [3,]  19.428571   11.14286  2.332820 0.164627906 -0.241653531     0     0
#>  [4,]   7.500000   10.50000  2.221809 0.053628615 -0.075842315     0     0
#>  [5,]  11.333333   16.00000  2.886381 0.722372738 -0.426618997     0     0
#>  [6,]  19.428571   23.14286  2.332820 0.164627906 -0.241653531     0     0
#>  [7,]   7.500000   22.50000  2.221809 0.053628615 -0.075842315     0     0
#>  [8,]  19.000000   18.50000  2.401605 0.003888737 -0.005499505     0     0
#>  [9,]  16.000000   21.50000 10.000000 0.000000000  0.000000000     0     0
#> [10,]  16.000000   21.50000 10.000000 0.000000000  0.000000000     0     0
#>       sd_from_global_mean Class
#>  [1,]            18.08103     0
#>  [2,]            26.82941     0
#>  [3,]            12.21618     0
#>  [4,]            10.30462     0
#>  [5,]            17.18624     0
#>  [6,]            23.68555     0
#>  [7,]            21.77399     0
#>  [8,]            19.07910     0
#>  [9,]            23.37742     0
#> [10,]            24.10146     0
#> 
#> , , 2
#> 
#>       cluster_id pixels length width height total_value l2w_ratio centroid_x
#>  [1,]          2      8      4    11      5   18.631382 0.3636364   2.625000
#>  [2,]          3      4      3     6      4    9.991864 0.5000000   4.250000
#>  [3,]          3     11      4    10      7   27.686329 0.4000000   2.272727
#>  [4,]          2      2      2     4      2    4.443618 0.5000000   2.500000
#>  [5,]          4      8      4     9      7   22.176576 0.4444444   2.000000
#>  [6,]          6     11      4    10      7   27.686329 0.4000000   2.272727
#>  [7,]          5      2      2     4      2    4.443618 0.5000000   2.500000
#>  [8,]          1     74      4    10      8  724.803209 0.4000000   9.445946
#>  [9,]          1    144      4     9      4 1440.000000 0.4444444   8.500000
#> [10,]          1    144      4     9      4 1440.000000 0.4444444   6.500000
#>       centroid_y centroid_z      mean    std_dev       slope       quad1
#>  [1,]    7.25000   17.00000  2.328923 0.04843969 -0.02001538 -0.04475575
#>  [2,]    8.00000   26.75000  2.497966 0.37876994  0.20565760  0.29084377
#>  [3,]   20.36364   12.00000  2.516939 0.36773529  0.07910776  0.17689032
#>  [4,]    7.50000   10.50000  2.221809 0.05362862 -0.07584231  0.00000000
#>  [5,]   11.25000   16.50000  2.772072 0.65703415 -0.18361442 -0.39665248
#>  [6,]   20.36364   24.00000  2.516939 0.36773529  0.07910776  0.17689032
#>  [7,]    7.50000   22.50000  2.221809 0.05362862 -0.07584231  0.00000000
#>  [8,]   16.08108   21.41892  9.794638 1.24058314  3.03880820  6.79498171
#>  [9,]   16.00000   21.50000 10.000000 0.00000000  0.00000000  0.00000000
#> [10,]   16.00000   21.50000 10.000000 0.00000000  0.00000000  0.00000000
#>              quad2 sd_from_global_mean Class
#>  [1,]  0.068672425            18.87633     0
#>  [2,]  0.111180149            27.22707     0
#>  [3,] -0.075534847            13.36312     0
#>  [4,]  0.000000000            10.30462     0
#>  [5,]  0.181847976            17.75971     0
#>  [6,] -0.075534847            24.83249     0
#>  [7,]  0.000000000            21.77399     0
#>  [8,]  0.002749752            21.93345     0
#>  [9,]  0.000000000            23.37742     0
#> [10,]  0.000000000            24.10146     0
#> 
#> , , 3
#> 
#>       cluster_id pixels length width height total_value l2w_ratio centroid_x
#>  [1,]          2     15      6    12     11    36.07217 0.5000000   3.933333
#>  [2,]          3      8      6     6      7    19.15381 1.0000000   5.750000
#>  [3,]          3     12      5    10      7    29.89010 0.5000000   2.500000
#>  [4,]          2      7      6     8      7    15.46767 0.7500000   5.428571
#>  [5,]          4     10      6     9      7    27.21067 0.6666667   2.800000
#>  [6,]          6     12      5    10      7    29.89010 0.5000000   2.500000
#>  [7,]          5      7      6     8      7    15.46767 0.7500000   5.428571
#>  [8,]          1     74      4    10      8   724.80321 0.4000000   9.445946
#>  [9,]          1    144      4     9      4  1440.00000 0.4444444   8.500000
#> [10,]          1    216      6     9      4  2160.00000 0.6666667   7.500000
#>       centroid_y centroid_z      mean    std_dev         slope         quad1
#>  [1,]   6.866667   17.00000  2.404811 0.22145188  2.684344e-02  1.122942e-01
#>  [2,]   7.500000   26.75000  2.394226 0.27233391 -1.211868e-02 -5.025964e-02
#>  [3,]  20.750000   12.00000  2.490842 0.36208921 -3.224912e-02 -1.019807e-01
#>  [4,]   5.428571   13.00000  2.209668 0.09859642 -5.492709e-03 -2.264702e-02
#>  [5,]  11.800000   16.60000  2.721067 0.61131389 -8.969827e-02 -3.444927e-01
#>  [6,]  20.750000   24.00000  2.490842 0.36208921 -3.224912e-02 -1.019807e-01
#>  [7,]   5.428571   25.00000  2.209668 0.09859642 -5.492709e-03 -2.264702e-02
#>  [8,]  16.081081   21.41892  9.794638 1.24058314  3.038808e+00  6.794982e+00
#>  [9,]  16.000000   21.50000 10.000000 0.00000000  0.000000e+00  0.000000e+00
#> [10,]  16.000000   21.50000 10.000000 0.00000000 -1.243191e-15 -5.200640e-15
#>               quad2 sd_from_global_mean Class
#>  [1,]  1.116847e-01            18.87633     0
#>  [2,] -2.566593e-01            27.42589     0
#>  [3,] -3.379889e-01            13.17197     0
#>  [4,]  1.005986e-01            14.12775     0
#>  [5,]  2.895315e-01            17.37740     0
#>  [6,] -3.379889e-01            24.64133     0
#>  [7,]  1.005986e-01            25.59712     0
#>  [8,]  2.749752e-03            21.93345     0
#>  [9,]  0.000000e+00            23.37742     0
#> [10,]  4.747513e-15            24.10146     0
#> 
#> , , 4
#> 
#>       cluster_id pixels length width height total_value l2w_ratio centroid_x
#>  [1,]          2     20      8    12     12    47.82791 0.6666667   4.750000
#>  [2,]          3      9      7     6      7    22.79338 1.1666667   6.111111
#>  [3,]          3     12      5    10      7    29.89010 0.5000000   2.500000
#>  [4,]          2      8      8     8      7    18.15160 1.0000000   5.875000
#>  [5,]          4     10      6     9      7    27.21067 0.6666667   2.800000
#>  [6,]          6     12      5    10      7    29.89010 0.5000000   2.500000
#>  [7,]          5      8      8     8      7    18.15160 1.0000000   5.875000
#>  [8,]          1     74      4    10      8   724.80321 0.4000000   9.445946
#>  [9,]          1    144      4     9      4  1440.00000 0.4444444   8.500000
#> [10,]          1    216      6     9      4  2160.00000 0.6666667   7.500000
#>       centroid_y centroid_z      mean   std_dev         slope         quad1
#>  [1,]   6.650000   16.75000  2.391396 0.2017860  6.123477e-04  3.968466e-03
#>  [2,]   7.555556   26.66667  2.532598 0.4870484  1.278800e-01  6.766772e-01
#>  [3,]  20.750000   12.00000  2.490842 0.3620892 -3.224912e-02 -1.019807e-01
#>  [4,]   5.250000   13.25000  2.268950 0.1909116  4.889742e-02  2.817442e-01
#>  [5,]  11.800000   16.60000  2.721067 0.6113139 -8.969827e-02 -3.444927e-01
#>  [6,]  20.750000   24.00000  2.490842 0.3620892 -3.224912e-02 -1.019807e-01
#>  [7,]   5.250000   25.25000  2.268950 0.1909116  4.889742e-02  2.817442e-01
#>  [8,]  16.081081   21.41892  9.794638 1.2405831  3.038808e+00  6.794982e+00
#>  [9,]  16.000000   21.50000 10.000000 0.0000000  0.000000e+00  0.000000e+00
#> [10,]  16.000000   21.50000 10.000000 0.0000000 -1.243191e-15 -5.200640e-15
#>               quad2 sd_from_global_mean Class
#>  [1,] -8.046562e-02            18.87633     0
#>  [2,]  5.305460e-01            27.22707     0
#>  [3,] -3.379889e-01            13.17197     0
#>  [4,]  3.356362e-01            14.31890     0
#>  [5,]  2.895315e-01            17.37740     0
#>  [6,] -3.379889e-01            24.64133     0
#>  [7,]  3.356362e-01            25.78827     0
#>  [8,]  2.749752e-03            21.93345     0
#>  [9,]  0.000000e+00            23.37742     0
#> [10,]  4.747513e-15            24.10146     0
#>