lds linear dynamical system.
DESCRIPTION
data X is represented as trials x features x timepoints
State can be partially observed/unobserved during training.
partial observability of multiple observations is also supported
observations are normally distributed conditional on the state.
multiple observation sequences are supported
bias term is *NOT* automatically added to the model
K = number of states
M = number of observations
T = number of timesteps
X and Y are swapped wrt the Kalman filter conventions
EXAMPLE
rand('seed',2); randn('seed',2);
nsamples = 1000; ncov = 2; ncycles = 10; ntrials = 2;
Y = sin(ncycles * 2 * pi * (1:nsamples) ./ nsamples);
Y = repmat(reshape(Y,[1 1 numel(Y)]),[ntrials 1 1]);
X = repmat(Y,[1 ncov 1]) + 0.5*randn(ntrials,ncov,nsamples);
k = dml.lds('inference','smooth','verbose',true,'indims',[ncov nsamples]);
k = k.train(X,Y);
Z = k.test(X);
figure
plot(squeeze(Y(1,:,:))','k');
hold on;
plot(squeeze(Z(1,:,:))','r');
legend('real','predicted');
k = dml.lds('verbose',true);
k = k.train(X,nan(size(Y))); % hidden state estimation
U = repmat(Y,[1 ncov 1]) + 0.1*randn(ntrials,ncov,nsamples);
Z = k.test(U);
figure
plot(squeeze(Y(1,:,:))','k--','LineWidth',2);
hold on;
plot(zscore(squeeze(Z(1,:,:))'),'r','LineWidth',2);
plot(squeeze(X(1,:,:))','bo');
legend('real','predicted','observed');
k = dml.lds('inference','smooth','verbose',true);
k = k.train(X,[Y nan(size(Y))]); % mixture of hidden + observed states
U = repmat(Y,[1 ncov 1]) + 0.1*randn(ntrials,ncov,nsamples);
Z = k.test(X);
figure
plot(zscore(squeeze(Y(1,:,:))'),'k');
hold on;
plot(zscore(squeeze(Z(1,:,:))'),'r');
plot(zscore(squeeze(X(1,:,:))'),'bo');
legend('real','predicted','observed');
REFERENCES
Pattern Recognition and Machine Learning, Bishop
A unifying review of linear dynamical systems, Gharamani
DEVELOPER
Marcel van Gerven (m.vangerven@donders.ru.nl)
Ali Bahramisharif (ali@cs.ru.nl)