フィルターのクリア

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!

採用された回答

KSSV
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
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!

Translated by