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!