Also, in a related way in mlp.m, the way you're populating the label matrices in not optimal (line 53 onwards). You can do the following:
disp('Now calculating the training label matrix')
C=unique(targets);
% new_targets = strcmp(repmat(targets,1,length(C)),repmat(C',length(targets),1));
new_targets = bsxfun(@eq,repmat(targets,1,length(C)),repmat(C',length(targets),1));
% clear C, label;
disp('done!')
size(new_targets)
Where either of bsxfun and strcmp are used depending on whether the labels are numeral or characters. It should be faster than what you're doing right now, and will work for character labels as well. The same also applies to populating label matrices for validation set.
Hey,
Two more things.
C=unique(X_labels); % Layers configuration layers = [size(X,2), 1000, 500, length(C)];
disp('Now calculating the training label matrix') C=unique(targets); % new_targets = strcmp(repmat(targets,1,length(C)),repmat(C',length(targets),1)); new_targets = bsxfun(@eq,repmat(targets,1,length(C)),repmat(C',length(targets),1)); % clear C, label; disp('done!') size(new_targets)
Where either of bsxfun and strcmp are used depending on whether the labels are numeral or characters. It should be faster than what you're doing right now, and will work for character labels as well. The same also applies to populating label matrices for validation set.
Best, Vikrant.