How can i load file to train data for Sequence-to-Sequence Regression Using Deep Learning
4 次查看(过去 30 天)
显示 更早的评论
I have been trying this code from https://au.mathworks.com/help/deeplearning/examples/sequence-to-sequence-regression-using-deep-learning.html#SequencetoSeq to forecast multivariate timeseries data. But couldn't open the file to load the data and then train. Can anyone help me please
filenamePredictors = fullfile(dataFolder,"train_FD001.txt");
[XTrain,YTrain] = prepareDataTrain(filenamePredictors);
***MY CODE
filename = "C:\Users\Documents\Research\threevartest.txt ";
dataFolder = "data";
filenamePredictors = fullfile(dataFolder,"C:\Users\Documents\Research\threevartest.txt ");
[XTrain,YTrain] = prepareDataTrain(filenamePredictors);
function [XTrain,YTrain] = prepareDataTrain(filenamePredictors)
dataTrain = dlmread(filenamePredictors);
numObservations = max(dataTrain(:,1));
XTrain = cell(numObservations,1);
YTrain = cell(numObservations,1);
for i = 1:numObservations
idx = dataTrain(:,1) == i;
X = dataTrain(idx,3:end)';
XTrain{i} = X;
timeSteps = dataTrain(idx,2)';
Y = fliplr(timeSteps);
YTrain{i} = Y;
end
end
******************************Shows me error
Error using fopen
Unable to find file. Ensure file exists and path is valid.
Error in dlmread (line 60)
[fid, theMessage] = fopen(filename);
Error in twovartest1>prepareDataTrain (line 11)
dataTrain = dlmread(filenamePredictors);
Error in twovartest1 (line 7)
[XTrain,YTrain] = prepareDataTrain(filenamePredictors);
0 个评论
回答(1 个)
Raunak Gupta
2019-12-3
Hi,
From the error message I can tell that dataset file is missing. So, first you may try to download data mentioned in Download Data . You need to save the data file in the directory where script is present and there are some helper function mentioned at the bottom of the example. Those should be saved as separate functions before calling full script.
0 个评论
另请参阅
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!