Filter löschen
Filter löschen

Split data into training and validation sets

17 Ansichten (letzte 30 Tage)
Killian Flynn
Killian Flynn am 27 Dez. 2022
Beantwortet: the cyclist am 27 Dez. 2022
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

Akzeptierte Antwort

the cyclist
the cyclist am 27 Dez. 2022
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),:);

Weitere Antworten (0)

Kategorien

Mehr zu Sequence and Numeric Feature Data Workflows finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by