cpd_scores: Change point scores of a sequence model

View source: R/cpd_members.R

cpd_scoresR Documentation

Change point scores of a sequence model

Description

Scores in ⁠[0, 1]⁠ of every time step of every sequence: the probability of change of an indid() model, or the processed similarity of consecutive windows of a tscp2() or ts2vec() model. For calibrated models (cpd_calibrate()) the calibrated scores, and for ensembles (cpd_ensemble()) the scores of every member.

Usage

cpd_scores(model, x, ...)

Arguments

model

A model: indid, tscp2, ts2vec, cpd_calibrated or cpd_ensemble.

x

Sequences, in the formats accepted by indid().

...

Unused.

Value

A matrix ⁠[sequence, time]⁠; for an ensemble an array ⁠[member, sequence, time]⁠. The representation models (TS-CP2 and SN-TS2Vec) have no score for the first 2 * window - 1 steps (NA).

Examples

set.seed(1)
# 8 sequences of 12 steps with 2 features; the mean moves at step 7.
x <- array(stats::rnorm(8 * 12 * 2), c(8, 12, 2))
x[, 7:12, ] <- x[, 7:12, ] + 3
model <- ts2vec(x, window = 3, output_dim = 4, hidden_dim = 8, depth = 2, epochs = 5, seed = 1)
round(cpd_scores(model, x[1:2, , ]), 2)

heimdall documentation built on Dec. 2, 2026, 5:08 p.m.