How to randomly divide two time-series of input values and target values into training, validation and test sets?
1 次查看(过去 30 天)
显示 更早的评论
I am new to Matlab.
I have my time-series of input values x (220*1) and target values y (220*1) that are resembled in two seperate Workplaces. I want to randomly divide (x,y) into trainning, validation and test set in proportion of (0.8, 0.1, 0.1) to find the best degree of my Polynomial Curve Fitting. However, I couldn't follow the instruction by https://www.mathworks.com/help/deeplearning/ref/dividerand.html since my data are in seperate sheet, and I don't know how to write the codes achieving such purpose with each y values corresponds to the x values that are in the same row.
Could you please show me the codes of doing that?
Thank you so much!
0 个评论
采纳的回答
KSSV
2019-4-29
x = 1:220 ;
y = rand(size(x)) ;
Q = [x' y'] ;
trainRatio = 70/100 ;
valRatio = 15/100 ;
testRatio = 15/100 ;
[trainInd,valInd,testInd] = dividerand(length(x),trainRatio,valRatio,testRatio) ;
training = Q(trainInd,:) ;
validation = Q(valInd,:) ;
testing = Q(testInd,:) ;
2 个评论
MatLabMcLovinPotato
2020-6-8
Curious please - wondering if this could be changed to be:
- not random
- for 3 (not one) input
- a timeseries (can / does data data some into training?)
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!