Latent ode for mackey glass time series data

5 vues (au cours des 30 derniers jours)
Muhammad
Muhammad le 29 Août 2023
Hello,
I want to know that can we use
Train Latent ODE Network with Irregularly Sampled Time-Series Data
this code for mackey glass time series data?
thank you

Réponses (1)

Anushka
Anushka le 28 Mar 2025
Yes, you can use the ‘Train Latent ODE Network with Irregularly Sampled Time-Series Data’ example for the Mackey-Glass time series, but you need to make a few modifications. Here’s how you can get started:
  1. Generate Mackey-Glass Data: First, you'll need to create the time series using a recurrence relation. Make sure to normalize the data so it fits well with the network
  2. Irregular Sampling: To mimic real-world data collection, randomly select some time points to simulate irregular sampling
  3. Integrate into the Network: Replace the example's synthetic data with your Mackey-Glass data. Use ‘arrayDatastore to prepare the data for training.
  4. Fine-Tuning: Since the Mackey-Glass series is chaotic, you might need to tweak some network parameters like the learning rate, number of epochs, or even the architecture of the network itself. This helps the model better capture the complexities of your data.
You can refer to the following MATLAB code for a better understanding:
% Step 1
tau = 17;
beta = 0.2;
gamma = 0.1;
n = 10;
tFinal = 1000;
dt = 1;
numSamples = tFinal / dt;
x = zeros(1, numSamples);
x(1:tau) = 0.9;
for t = (tau + 1):numSamples
x(t) = x(t-1) + dt * (beta * x(t-tau) / (1 + x(t-tau)^n) - gamma * x(t-1));
end
% Normalize the data
x = (x - min(x)) / (max(x) - min(x));
time = (0:dt:(numSamples-1)*dt)';
data = x';
figure;
plot(time, data);
xlabel('Time');
ylabel('Value');
title('Mackey-Glass Time Series');
% Step 2
% Simulate irregular sampling
numPoints = 300;
rng(42);
irregularIndices = sort(randperm(numSamples, numPoints));
irregularTime = time(irregularIndices);
irregularData = data(irregularIndices);
trainData = {irregularData};
trainTime = {irregularTime};
% Step 3
% Replace synthetic data with Mackey-Glass data
dsTrain = arrayDatastore(trainData, 'IterationDimension', 1);
dsTrainTime = arrayDatastore(trainTime, 'IterationDimension', 1);
dsTrainCombined = combine(dsTrain, dsTrainTime);
You can refer to the following documentation link of 'arrayDataStore' for a better understanding: https://www.mathworks.com/help/matlab/ref/matlab.io.datastore.arraydatastore.html
Hope it helps!

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by