Previously:
Hi Bob,
Q : How to reset the feature column to be class and class to be the feature.
...........
Answer:
If features and labels are given as columns in an array DATA and the labels are in column L then a proper PRTools dataset may be constructed by
DAT = DATA;
DAT(:,L) = []
A = dataset(DAT,DATA(:,L));
Hope this helps.
Bob Duin
Next Q: I have tried to flip the feature and label column but it complained
“Crisp labels cannot be supplied by a dataset, reset labtype first”.
So I set the label, but still the same error occured. Anything I missed out?
Thanks again.
A = dataset(DiscretIrisTrainA,DiscretIrisTrainAA);
....
for i = 1 : nvars %for each feature/attribute
z = 0;
B = [A(:,i) A.labels];
C = B(:,1:2); % get each feature and its class
[D I] = sort(C(:,1),’ascend’); %sort
E = C(I,:);
DAT = E;
DAT(:,2)=[]; % empty the label, DAT has feature column
DAT = setlabtype(DAT,’crisp’); % suppose to reset the label type
A=dataset(E(:,2),DAT);

