Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- numTimePoints = 50;
- sampleSize = 100;
- timePoints = 1:numTimePoints*sampleSize;
- totalMissingSize = numTimePoints * sampleSize * 0.3;
- while true
- loc = randsample(timePoints, 1);
- missingPeriod = min(3 + randi(21, 1, 1), length(timePoints) + totalMissingSize - numTimePoints*sampleSize);
- for j = randperm(missingPeriod)
- if all(ismember(loc-missingPeriod+j:loc+j-1, timePoints))
- timePoints = setdiff(timePoints, loc-missingPeriod+j:loc+j-1);
- break
- end
- end
- if numTimePoints*sampleSize - totalMissingSize >= length(timePoints)
- break
- end
- end
- missingLabel = setdiff(1:numTimePoints*sampleSize, timePoints);
Advertisement
Add Comment
Please, Sign In to add comment