Split data into training and validation sets

13 次查看(过去 30 天)
Hello I am trying to split this data into a 70% and 30% partition with 70% stored for training and 30% for validation for training a neural network. Any help would be greatly appreciated.
data =readtable('EURUSD=X.csv');
%training = first 70% of data
%testing = last 30% of data

采纳的回答

the cyclist
the cyclist 2022-12-27
There are several ways to do this. (I'm curious if you even tried to google this, because there are many answers online.)
Here is one way. There are perhaps more elegant ways, if you have the Statistics and Machine Learning Toolbox. (For example, you could use the cvpartition function.)
numberObservations = height(data);
randomizedIndices = randperm(numberObservations);
numberTraining = floor(0.7*numberObservations);
dataTraining = data(randomizedIndices(1:numberTraining),:);
dataTest = data(randomizedIndices(numberTraining+1:end),:);

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Sequence and Numeric Feature Data Workflows 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by