필터 지우기
필터 지우기

plz tell the syntax to add noise in the dataset

조회 수: 2 (최근 30일)
sani ars
sani ars 2012년 5월 31일
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..??
  댓글 수: 1
Walter Roberson
Walter Roberson 2012년 5월 31일
duplicate is at http://www.mathworks.com/matlabcentral/answers/39830-what-is-the-syntax-to-add-noise-in-data-set

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

답변 (1개)

Ilya
Ilya 2012년 5월 31일
Use cvpartition to select a known fraction of your data at random. For example, flip class labels in 10% of the data:
>> load ionosphere
>> Y = strcmp('g',Y); % convert Y to a logical array
>> cvpart = cvpartition(size(X,1),'holdout',0.1) % sampling without stratification
cvpart =
Hold-out cross validation partition
N: 351
NumTestSets: 1
TrainSize: 316
TestSize: 35
>> idxToFlip = test(cvpart); % labels to flip
>> Y(idxToFlip) = ~Y(idxToFlip);
Instead of non-stratified sampling, you might want to stratify by class:
>> cvpart = cvpartition(Y,'holdout',0.1) % sampling with stratification

카테고리

Help CenterFile Exchange에서 Model Building and Assessment에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by