Info
この質問は閉じられています。 編集または回答するには再度開いてください。
how to remove a number from 1 to 7 if I don't want this??
1 回表示 (過去 30 日間)
古いコメントを表示
I have the code as :
rng(1,'twister');
index = randsample(N_of_data,prcnt_train);
train_labels(index) = rem(train_labels(index)+1,7)+1;
Actually, I have satellite image data set that actually have 7 classes labelled as:
1 2 3 4 5 7.... it has the class 6 but it is not mandatory.....
so I have the labels 1 2 3 4 5 7....
I have to introduce class label noise in satellite image dataset i.e. change their actual labels from the range 1 to 7 (excluding 6).....
Through 'rem' function I am changing their labels... This function also generate the label 6. But in actual, there is no need of that label as I don't have any class with this name in the dataset.....
So, what should I do to get only these labels 1 2 3 4 5 7...... and no label 6 should come i.e. number 6 should not be generated...
The problem is I can't replace the label 7 with 6 in the dataset as this is publicly available dataset from UCI repository.....
So how to write the code for it OR what changes should be made in 'rem' function??....
0 件のコメント
回答 (2 件)
the cyclist
2012 年 6 月 10 日
I am not 100% sure I understand your question, but you can generate random samples from the vector 1:7 (except 6) like this:
>> randsample([1:5 7],100,'true')
0 件のコメント
この質問は閉じられています。
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!