How to randomly divide two time-series of input values and target values into training, validation and test sets?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Robin Li
el 29 de Abr. de 2019
Comentada: MatLabMcLovinPotato
el 8 de Jun. de 2020
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 comentarios
Respuesta aceptada
KSSV
el 29 de Abr. de 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 comentarios
MatLabMcLovinPotato
el 8 de Jun. de 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?)
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!