필터 지우기
필터 지우기

what is the syntax to add noise in data set

조회 수: 1 (최근 30일)
sani ars
sani ars 2012년 5월 30일
I need the syntax to add noise to data set..
I hv write the code as:
rand_class_data = randsample(data(:,:),data*10/100);
y(rand_class_data)= ~y(rand_class_data);
wrong_labels = y;
%testing ensemble on noised data
losswith_noised_data = loss(ens_on_traindata, rand_class_data,wrong_labels)
--------------------------------------------------
the dataset im using is ''ionosphere'
I want to change the labels that i hd done with
y(rand_class_data)= ~y(rand_class_data);
but the problem is with data
i.e. how should i randsample the data??..
mean to say how to write
r = randsample(data(:,:),data*10/100);
the error is as :
"POPULATION must be a vector."
plz suggest me the right syntax to randsample the data

답변 (2개)

Andrei Bobrov
Andrei Bobrov 2012년 5월 30일
may be using data(:)?
eg
rand_class_data = randsample(data(:),round(numel(data)*10/100))
  댓글 수: 1
sani ars
sani ars 2012년 5월 30일
yes .... u r right..... Actually my code is as follows:
data_set = load('ionosphere.txt');
data = data_set(:,1:end-1);
y = data_set(:, end);
train_data = data(1:2:end,:);
train_labels = y(1:2:end);
test_data = data(2:2:end,:);
test_labels = y(2:2:end);
then I had construct an ensemble by using training data as follows:
ens_on_traindata = fitensemble(train_data,train_labels,'AdaBoostM1',100,'tree','type','classification');
then determine then loss (misclassification) of the test data by using the ensemble i.e tested the performance of ensemble on test data as follows:
Losswith_test_data = loss(ens_on_traindata, test_data, test_labels);
Now I wants to analyze the sensitivity of AdaboostM1 and evaluate its performance in the presence of noise..... So thats why I have introduced the noise (classification noise) in the dataset by changing the labels of 10 % of the dataset....
In the Help of MATLAB 2011a, they have added the noise in the artificial dataset...... I tried to use the same with ionosphere dataset, but the problem is with the syntax i.e. in what way I should write the data..
and how to write the randsample( , );
plz can u help me in this regard..??

댓글을 달려면 로그인하십시오.


Walter Roberson
Walter Roberson 2012년 5월 31일
Your question is still active here. Please do not ask duplicate questions.

Community Treasure Hunt

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

Start Hunting!

Translated by