Info
此问题已关闭。 请重新打开它进行编辑或回答。
how to remove a number from 1 to 7 if I don't want this??
2 次查看(过去 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!