Category: matlab

Randomly picking equal number of samples for each label in Matlab

No_of_samples are samples which will remain in your data set for each label after you execute the following code:-

classes = unique(labels);
for i=1:numel(classes)
      cur_class_ind = find(labels==classes(i));
      ind_to_remove = cur_class_ind(randperm(numel(cur_class_ind)));
      ind_to_remove = ind_to_remove(1:(numel(cur_class_ind) - no_of_samples));
      labels(ind_to_remove,:) = [];
      data(ind_to_remove,:) = [];
end

Here ‘data’ is your input dataset with m x n dimension(m=number of samples which we are trying to crop and n =number of features) and ‘labels’ is your vector containing output classes for every corresponding input sample.

Loading files iteratively for processing in Matlab

Loading files iteratively for processing in Matlab

If you are a researcher and works in Machine Learning then your work certainly would involve data processing on Matlab. Feature engineering involves extracting features from large number of files(usually csv) and these files need to be parsed so they can be loaded iteratively and processed.

12166223_10207341791961524_1589943820_n

Continue reading “Loading files iteratively for processing in Matlab”