split dataset with probability weights
Mostrar comentarios más antiguos
Hello everyone
i have a dataset like 20 x 6. i want to split dataset (npop1) into two dataset which depend on probabbility 'weights'. the probability comes from random number r1. i can't figure out how to store the rest data into another variable dataset (rw2). I don't use randperm because randperm has no probability function. I will appreciate any help. Thank you.
Sorry for my bad English..
pc = 0.4; %percentage to split data
nfitA = length(fitA);
PC = pc*npop;% make positive interger
r1 = rand (nfitA,1); %random number for weight probability
rw1 = datasample(npop1,PC,'Weights',r1);
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Multinomial Distribution en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!