필터 지우기
필터 지우기

Split data into training and validation sets

조회 수: 17 (최근 30일)
Killian Flynn
Killian Flynn 2022년 12월 27일
답변: the cyclist 2022년 12월 27일
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