How can i load file to train data for Sequence-to-Sequence Regression Using Deep Learning

4 ビュー (過去 30 日間)
israt fatema
israt fatema 2019 年 11 月 28 日
回答済み: Raunak Gupta 2019 年 12 月 3 日
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);

回答 (1 件)

Raunak Gupta
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.

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by