您可以将SAX 转换分别应用于每个维度,然后组合每个时间戳的符号/字母。
以 (x,y,z,t) 为例,你会得到组合 b,a,c 代表 t=1,然后 a,a,c 代表 t=2 等等。
然后,您可以根据需要将这些符号组合成“巨型符号”。假设符号集是Symbols={a,b,c}。那么新的一组字母就是笛卡尔积SxSxS(每个维度一个)。
换句话说,aaa 成为新字母 A,aab 为 B,然后是 aac,aba,abb,等等。
编辑:
这里有一些代码来展示我的想法。由于我没有 SAX 算法的实现,我将使用以下函数作为占位符(它返回垃圾):
%# use your actual SAX function instead of this one
my_sax_function = @(x,n,a) randi(a, [n 1]);
代码如下:
%# time series of length=100, with (x,y,z) at each timestamp
data = cumsum(randn(100,3));
%# apply your SAX function to each dimension independently
N = 20; %# number of segments to divide the signal into
A = 3; %# size of alphabet (a,b,c)
dataSAX = zeros(N,3);
for i=1:3
dataSAX(:,i) = my_sax_function(data(:,i), N, A);
end
%# we assume the above function returns integers denoting the symbols
%# therefore row i corresponds to A=3 symbols for each of the 3 x/y/z dimensions
dataSAX(1,:)
%# build cartesian product of all combinations of the A=3 symbols
[x y z] = ndgrid(1:A,1:A,1:A);
cartProd = [x(:) y(:) z(:)];
%# map to the new alphabet with 3*3*3 = 27 symbols
[~,V] = ismember(dataSAX, cartProd, 'rows')
%# A to Z with $ character to make up 27 symbols
oldSymbols = {'a';'b';'c'}; %# 1: a, 2: b, 3: c
newSymbols = cellstr(['A':'Z' '$']'); %# 1: A, ..., 26: Z, 27: $
%# SAX representation of the entire time series as a string
mappedV = char(newSymbols(V))'