Effacer les filtres
Effacer les filtres

Split data into training and validation sets

17 vues (au cours des 30 derniers jours)
Killian Flynn
Killian Flynn le 27 Déc 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

Réponse acceptée

the cyclist
the cyclist le 27 Déc 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),:);

Plus de réponses (0)

Catégories

En savoir plus sur Sequence and Numeric Feature Data Workflows dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by