Skip to content

Transforms a signature matrix into a pattern space matrix by processing each row to reflect categorical changes (increase, decrease, no change) in sequence values. These changes are then hashed to create unique pattern identifiers.

Usage

patternSpace(SM)

Arguments

SM

Numeric matrix; signature matrix where each row represents differences between successive elements in the original time series data. Must contain only numeric values.

Value

A numeric matrix where each row contains hashed pattern identifiers derived from categorical changes in the signature matrix. Returns a matrix with NA values if any row contains NA values.

Details

Transform Signature Matrix into Pattern Space Matrix

The function performs these key steps:

  • Converts numerical differences into categorical changes (1: decrease, 2: no change, 3: increase)

  • Applies a hashing function (detailed below) to generate unique identifiers for each pattern

  • Handles missing values by returning NA for rows containing NA values.

Examples

signatureMatrix <- matrix(c(1, -1, 0, 2, -2, 0, 1, -1, 0), 
                         nrow = 3, byrow = TRUE)
patternSpaceMatrix <- patternSpace(signatureMatrix)
print(patternSpaceMatrix)
#>      [,1]
#> [1,]  282
#> [2,]  282
#> [3,]  282