- 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
- Irregular Sampling: To mimic real-world data collection, randomly select some time points to simulate irregular sampling
- Integrate into the Network: Replace the example's synthetic data with your Mackey-Glass data. Use ‘arrayDatastore’ to prepare the data for training.
- 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.
Latent ode for mackey glass time series data
5 views (last 30 days)
Show older comments
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
0 Comments
Answers (1)
Anushka
on 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:
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!
0 Comments
See Also
Categories
Find more on Ordinary Differential Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!