Borrar filtros
Borrar filtros

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

Respuesta aceptada

KSSV
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,:) ;

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by