This function trains a model that uses a dictionary to predict state changes. Differently from fluss(), it doesn't look for semantic changes (that may be several), but for binary states like "on" or "off". Think for example that a human annotator is pressing a switch any time he thinks that the recorded data is relevant, and releases the switch when he thinks the data is noise. This algorithm will learn the switching points (even better) and try to predict using new data.

sdts_predict(model, data, window_size)

Arguments

model

a model created by SDTS training function sdts_train().

data

a vector of numeric. Time series.

window_size

an int. The average sliding window size.

Value

Returns a vector of logical with predicted annotations.

References

  • Yeh C-CM, Kavantzas N, Keogh E. Matrix profile IV: Using Weakly Labeled Time Series to Predict Outcomes. Proc VLDB Endow. 2017 Aug 1;10(12):1802-12.

Website: https://sites.google.com/view/weaklylabeled

See also

Other Scalable Dictionaries: sdts_score(), sdts_train()

Examples

# This is a fast toy example and results are useless. For a complete result, run the code inside
#' Not run' section below.
w <- c(110, 220)
subs <- 11000:20000
tr_data <- mp_test_data$train$data[subs]
tr_label <- mp_test_data$train$label[subs]
te_data <- mp_test_data$test$data[subs]
te_label <- mp_test_data$test$label[subs]
model <- sdts_train(tr_data, tr_label, w, verbose = 0)
#> Error in mat_pro[[i]]: subscript out of bounds
predict <- sdts_predict(model, te_data, round(mean(w)))
#> Error in sdts_predict(model, te_data, round(mean(w))): object 'model' not found
sdts_score(predict, te_label, 1)
#> Error in pred_tmp[seq_len(length(pred))] <- pred: incompatible types (from closure to logical) in subassignment type fix
# \donttest{
windows <- c(110, 220, 330)
model <- sdts_train(mp_test_data$train$data, mp_test_data$train$label, windows, verbose = 0)
#> Error in mat_pro[[i]]: subscript out of bounds
predict <- sdts_predict(model, mp_test_data$test$data, round(mean(windows)))
#> Error in sdts_predict(model, mp_test_data$test$data, round(mean(windows))): object 'model' not found
sdts_score(predict, mp_test_data$test$label, 1)
#> Error in pred_tmp[seq_len(length(pred))] <- pred: incompatible types (from closure to logical) in subassignment type fix
# }