-2

I have a severely unbalanced data set. I want to perform a uniform resampling with 200% of the original data set size.

the resample function seems cannot perform as I expected. Anyone knows any toolbox or function can perform this? Thanks.

  • 1
    can you explain what you tried and why it's not working? – jerad Nov 26 '12 at 23:16
  • @jerad Hi, I'm trying to resample the data to a) make it balanced (uniform resampling), and b) enlarge the data set to be twice of the original one. the Matlab function 'resample' seems not have the options or parameters as I wanted, and I haven't found any other function that can perform data resampling for unbalanced data set. Do you know any function that can perform this? Thank you very much. – evergreen8710 Nov 27 '12 at 23:03

1 Answers1

0

If you want to randomly resample with replacement from a data set of size N, you can use randi(N,1,N*2) to return a vector of size N*2 of random integers between 1 and N. Then use that vector to index into your original matrix. For example,

N = 100;
data = rand(1,N); % This simulates your original data set
idx  = randi(N, 1, N*2);
newData = data(idx);
jerad
  • 2,028
  • 15
  • 16