Effacer les filtres
Effacer les filtres

How to randomly divide two time-series of input values and target values into training, validation and test sets?

1 vue (au cours des 30 derniers jours)
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!

Réponse acceptée

KSSV
KSSV le 29 Avr 2019
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 commentaires
MatLabMcLovinPotato
MatLabMcLovinPotato le 8 Juin 2020
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?)

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by