Azzera filtri
Azzera filtri

Info

Questa domanda è chiusa. Riaprila per modificarla o per rispondere.

how to remove a number from 1 to 7 if I don't want this??

2 visualizzazioni (ultimi 30 giorni)
sani ars
sani ars il 10 Giu 2012
Chiuso: MATLAB Answer Bot il 20 Ago 2021
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??....

Risposte (2)

the cyclist
the cyclist il 10 Giu 2012
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')

Walter Roberson
Walter Roberson il 10 Giu 2012
Or generate from 1 to 6 and replace the 6's with 7's.

Questa domanda è chiusa.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by