Search for Motifs

find_motif(.mp, ...)

# S3 method for MatrixProfile
find_motif(
  .mp,
  data,
  n_motifs = 3,
  n_neighbors = 10,
  radius = 3,
  exclusion_zone = NULL,
  ...
)

# S3 method for MultiMatrixProfile
find_motif(
  .mp,
  data,
  n_motifs = 3,
  mode = c("guided", "unconstrained"),
  n_bit = 4,
  exclusion_zone = NULL,
  n_dim = NULL,
  ...
)

# S3 method for PMP
find_motif(
  .mp,
  data,
  n_motifs = 3,
  n_neighbors = 10,
  radius = 3,
  exclusion_zone = NULL,
  ...
)

Arguments

.mp

a MatrixProfile or MultiMatrixProfile object.

...

further arguments to be passed to class specific function.

data

the data used to build the Matrix Profile, if not embedded.

n_motifs

an int. Number of motifs to find. (Default is 3).

n_neighbors

an int. Number of neighbors to find. (Default is 10).

radius

an int. Set a threshold to exclude matching neighbors with distance > current motif distance * radius. (Default is 3).

exclusion_zone

if a number will be used instead of embedded value. (Default is NULL).

mode

a string. Guided or Unconstrained search. Allow partial match. (Default is guided).

n_bit

an int. Bit size for discretization. Ignored on Guided search. (Default is 4).

n_dim

an int. Number of dimensions to use on Guided search instead of embedded value. (Default is NULL).

Value

For class MatrixProfile, returns the input .mp object with a new name motif. It contains: motif_idx, a list

of motif pairs found and motif_neighbor a list with respective motif's neighbors.

For class MultiMatrixProfile, returns the input .mp object with a new name motif. It contains: motif_idx, a vector

of motifs found and motif_dim a list the dimensions where the motifs were found

For class PMP, returns the input .mp object with a new name motif. It contains: motif_idx, a list

of motif pairs found and motif_neighbor a list with respective motif's neighbors.

Examples

# Single dimension data
w <- 50
data <- mp_gait_data
mp <- tsmp(data, window_size = w, exclusion_zone = 1 / 4, verbose = 0)
mp <- find_motif(mp)

# Multidimension data
w <- mp_toy_data$sub_len
data <- mp_toy_data$data[1:200, ]
mp <- tsmp(data, window_size = w, mode = "mstomp", verbose = 0)
mp <- find_motif(mp)
pan <- tsmp(mp_gait_data, window_size = 20:30, mode = "pmp")
#> step: 1/11 binary idx: 1 window: 20
#> step: 2/11 binary idx: 6 window: 25
#> step: 3/11 binary idx: 3 window: 22
#> step: 4/11 binary idx: 9 window: 28
#> step: 5/11 binary idx: 2 window: 21
#> step: 6/11 binary idx: 4 window: 23
#> step: 7/11 binary idx: 7 window: 26
#> step: 8/11 binary idx: 10 window: 29
#> step: 9/11 binary idx: 5 window: 24
#> step: 10/11 binary idx: 8 window: 27
#> step: 11/11 binary idx: 11 window: 30
mp <- find_motif(pan)