Training data and Training target in Neural Networks
조회 수: 7 (최근 30일)
이전 댓글 표시
Hi,
I am having a signal in form of vector (1*25000). I want to split this signal into four parts x_train, y_train, x_test and y_test (according to 70-30% training and testing method) in MATLAB. Can anyone help me how to split this vector form signal into these four parts?
Thanks
댓글 수: 2
BN
2020년 2월 5일
편집: BN
2020년 2월 5일
This is a general question. you haven't told me how method do you want to split your data? do you want to split them randomly (from first, middle, and end of the dataset) or you want to use the first part as train and end part as a test?
Anyway, You don't need to do this manually, Matlab can automatically divide your data set in which way you want to split (random or not random). You can get more information Here. Or type:
help nndivide
You can choose the function do you want then using it in the code. For example, I want to split my data according to which way I want (first part for train and middle for validation and end part for test). So first I split my data in the indTrain, indVal, indTest by index them, then using divideind.
% For a list of all data division functions type: help nndivide
net.divideFcn = 'divideind'; % Divide data %Divide targets into three sets using specified indices%
net.divideMode = 'sample'; % Divide up every sample
net.divideParam.trainInd = indTrain; % 70% of the data set was used for train
net.divideParam.valInd = indVal; % 15% of the data set was used for validation
net.divideParam.testInd = indTest; % 15% of the data set was used for test
채택된 답변
Greg Heath
2020년 2월 9일
You cannot make any intelligent decisions until you have examined a plot of the data!!!
(WRONG!!! Plotting the data first is the ultimate beginning decision!!!)
Hope this helps.
Greg
댓글 수: 0
추가 답변 (1개)
Mahesh Taparia
2020년 2월 7일
Hi
You have correctly divided the data using randperm. Since you didn’t have ground truth, you are taking last 8750 as ground truth as per following code:
mat_1 = reshape(train_data, [rownr_1, colnr_1]);
x_train = mat_1(:,1);
y_train = mat_1(:,2);
which is incorrect. Select the correct ground truth.
댓글 수: 2
Mahesh Taparia
2020년 2월 10일
Hi
You mentioned earlier that your dataset is unlabeled, y_train would be the labels of x_train. Taking y_train (labels of x_train) as half of the data (which is amplitude) is illogical.
For supervised learning, there is a need of ground truth so collect the labels. Or else you can try with unsupervised learning approach like clusteriung.
참고 항목
카테고리
Help Center 및 File 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!