이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
How to repeat c parameter(box constraint) using different value?
조회 수: 1 (최근 30일)
이전 댓글 표시
Need Help
2015년 10월 11일
example below, i need to repeat 1 with others number
SVMStruct = svmtrain(data(train,:),Y(train),'Kernel_Function','linear','BoxConstraint',1,'showplot',true);
채택된 답변
Walter Roberson
2015년 10월 11일
if islogical(train)
numtrain = sum(train);
else
numtrain = length(train);
end
bc = rand(1, numtrain); %data of the appropriate size
SVMStruct = svmtrain( data(train,:), Y(train), 'Kernel_Function', 'linear', 'BoxConstraint', bc, 'showplot', true);
댓글 수: 12
Need Help
2015년 10월 11일
편집: Walter Roberson
2015년 10월 11일
part of my program is like below that i need to add more values other than 1 next to the boxconstraint
for i = 1:K
figure
foldNo=i
test = (indices == i);
train = ~test;
SVMStruct = svmtrain(data(train,:),Y(train),'Kernel_Function','linear','BoxConstraint',1,'showplot',true);
sorry for my bad english
Walter Roberson
2015년 10월 11일
What you pass to BoxConstraint must be either a single value or else it must be a vector that has the same length as the number of samples you pass.
As I can see now that your train variable is logical, I can simplify what I posted above:
numtrain = sum(train);
Then
bc = rand(1, numtrain); %data of the appropriate size
Here, bc can be set to any vector that is of length numtrain . For example you could set
bc = ones(1, numtrain);
bc(3:3:end) = 4;
which would create the pattern [1 1 4 1 1 4 1 1 4 ...]
Then you pass this bc variable where you passed 1 before:
SVMStruct = svmtrain( data(train,:), Y(train), ...
'Kernel_Function', 'linear', ...
'BoxConstraint', bc, ... %NOTICE CHANGE
'showplot', true);
Need Help
2015년 10월 12일
편집: Walter Roberson
2015년 10월 12일
sorry what i mean that i need to add more values for example like your above
bc = 1
bc = 2
bc = 5
bc = 10
bc = 20
bc = 50
bc =100
SVMStruct = svmtrain( data(train,:), Y(train), 'Kernel_Function', 'linear', 'BoxConstraint', bc, 'showplot', true);
from bc = 1 it will show only 1 result, but i need to get all result from bc above.
really hope you can help
Walter Roberson
2015년 10월 12일
If you want to run the same training multiple times but with a different single bc value each time, then:
bcvals = [1 2 5 10 20 50 100];
for K = 1 : length(bcvals)
bc = bcvals(K);
SVMStruct{K} = svmtrain( data(train,:), Y(train), ...
'Kernel_Function', 'linear', ...
'BoxConstraint', bc, ...
'showplot', true);
end
This would return a cell array SVMStruct which has as many entries as the number of bc values you asked to process.
Need Help
2015년 10월 12일
편집: Walter Roberson
2015년 10월 16일
i get this..
insert no of PC=2
spot =
2
insert K-fold=3
K =
3
foldNo =
1
Label: ''
Description: ''
ClassLabels: {2x1 cell}
GroundTruth: [42x1 double]
NumberOfObservations: 42
ControlClasses: 2
TargetClasses: 1
ValidationCounter: 1
SampleDistribution: [42x1 double]
ErrorDistribution: [42x1 double]
SampleDistributionByClass: [2x1 double]
ErrorDistributionByClass: [2x1 double]
CountingMatrix: [3x2 double]
CorrectRate: 0.9762
ErrorRate: 0.0238
LastCorrectRate: 0.9762
LastErrorRate: 0.0238
InconclusiveRate: 0
ClassifiedRate: 1
Sensitivity: 1
Specificity: 0.9524
PositivePredictiveValue: 0.9545
NegativePredictiveValue: 1
PositiveLikelihood: 21
NegativeLikelihood: 0
Prevalence: 0.5000
DiagnosticTable: [2x2 double]
ans =
0.9762
conMat =
20 1
0 21
foldNo =
2
Label: ''
Description: ''
ClassLabels: {2x1 cell}
GroundTruth: [43x1 double]
NumberOfObservations: 43
ControlClasses: 2
TargetClasses: 1
ValidationCounter: 1
SampleDistribution: [43x1 double]
ErrorDistribution: [43x1 double]
SampleDistributionByClass: [2x1 double]
ErrorDistributionByClass: [2x1 double]
CountingMatrix: [3x2 double]
CorrectRate: 0.9767
ErrorRate: 0.0233
LastCorrectRate: 0.9767
LastErrorRate: 0.0233
InconclusiveRate: 0
ClassifiedRate: 1
Sensitivity: 1
Specificity: 0.9524
PositivePredictiveValue: 0.9565
NegativePredictiveValue: 1
PositiveLikelihood: 21
NegativeLikelihood: 0
Prevalence: 0.5116
DiagnosticTable: [2x2 double]
ans =
0.9767
conMat =
20 1
0 22
foldNo =
3
Label: ''
Description: ''
ClassLabels: {2x1 cell}
GroundTruth: [43x1 double]
NumberOfObservations: 43
ControlClasses: 2
TargetClasses: 1
ValidationCounter: 1
SampleDistribution: [43x1 double]
ErrorDistribution: [43x1 double]
SampleDistributionByClass: [2x1 double]
ErrorDistributionByClass: [2x1 double]
CountingMatrix: [3x2 double]
CorrectRate: 0.9767
ErrorRate: 0.0233
LastCorrectRate: 0.9767
LastErrorRate: 0.0233
InconclusiveRate: 0
ClassifiedRate: 1
Sensitivity: 0.9524
Specificity: 1
PositivePredictiveValue: 1
NegativePredictiveValue: 0.9565
PositiveLikelihood: NaN
NegativeLikelihood: 0.0476
Prevalence: 0.4884
DiagnosticTable: [2x2 double]
ans =
0.9767
conMat =
22 0
1 20
>>
Need Help
2015년 10월 16일
Hey, thanks . finally i get the answer from your solution.thank you very much. Can you help me a little bit more on how to get average of each answer above using array.
Walter Roberson
2015년 10월 16일
I have no idea what output we are looking at. It appears to show several intermediate calculations from some unspecified code, without indicating which variables have been saved or what their values are.
Also, you have not specified what you want to get the average of.
Need Help
2015년 10월 16일
편집: Walter Roberson
2015년 10월 16일
foldNo =
1
bc =
1
Label: ''
Description: ''
ClassLabels: {2x1 cell}
GroundTruth: [42x1 double]
NumberOfObservations: 42
ControlClasses: 2
TargetClasses: 1
ValidationCounter: 1
SampleDistribution: [42x1 double]
ErrorDistribution: [42x1 double]
SampleDistributionByClass: [2x1 double]
ErrorDistributionByClass: [2x1 double]
CountingMatrix: [3x2 double]
CorrectRate: 0.9762
ErrorRate: 0.0238
LastCorrectRate: 0.9762
LastErrorRate: 0.0238
InconclusiveRate: 0
ClassifiedRate: 1
Sensitivity: 1
Specificity: 0.9524
PositivePredictiveValue: 0.9545
NegativePredictiveValue: 1
PositiveLikelihood: 21
NegativeLikelihood: 0
Prevalence: 0.5000
DiagnosticTable: [2x2 double]
Acc =
0.9762
Sen =
1
Spe =
0.9524
conMat =
20 1
0 21
bc =
2
Label: ''
Description: ''
ClassLabels: {2x1 cell}
GroundTruth: [42x1 double]
NumberOfObservations: 42
ControlClasses: 2
TargetClasses: 1
ValidationCounter: 1
SampleDistribution: [42x1 double]
ErrorDistribution: [42x1 double]
SampleDistributionByClass: [2x1 double]
ErrorDistributionByClass: [2x1 double]
CountingMatrix: [3x2 double]
CorrectRate: 0.9762
ErrorRate: 0.0238
LastCorrectRate: 0.9762
LastErrorRate: 0.0238
InconclusiveRate: 0
ClassifiedRate: 1
Sensitivity: 1
Specificity: 0.9524
PositivePredictiveValue: 0.9545
NegativePredictiveValue: 1
PositiveLikelihood: 21
NegativeLikelihood: 0
Prevalence: 0.5000
DiagnosticTable: [2x2 double]
Acc =
0.9762
Sen =
1
Spe =
0.9524
conMat =
20 1
0 21
bc =
5
Label: ''
Description: ''
ClassLabels: {2x1 cell}
GroundTruth: [42x1 double]
NumberOfObservations: 42
ControlClasses: 2
TargetClasses: 1
ValidationCounter: 1
SampleDistribution: [42x1 double]
ErrorDistribution: [42x1 double]
SampleDistributionByClass: [2x1 double]
ErrorDistributionByClass: [2x1 double]
CountingMatrix: [3x2 double]
CorrectRate: 0.9762
ErrorRate: 0.0238
LastCorrectRate: 0.9762
LastErrorRate: 0.0238
InconclusiveRate: 0
ClassifiedRate: 1
Sensitivity: 1
Specificity: 0.9524
PositivePredictiveValue: 0.9545
NegativePredictiveValue: 1
PositiveLikelihood: 21
NegativeLikelihood: 0
Prevalence: 0.5000
DiagnosticTable: [2x2 double]
Acc =
0.9762
Sen =
1
Spe =
0.9524
conMat =
20 1
0 21
bc =
10
Label: ''
Description: ''
ClassLabels: {2x1 cell}
GroundTruth: [42x1 double]
NumberOfObservations: 42
ControlClasses: 2
TargetClasses: 1
ValidationCounter: 1
SampleDistribution: [42x1 double]
ErrorDistribution: [42x1 double]
SampleDistributionByClass: [2x1 double]
ErrorDistributionByClass: [2x1 double]
CountingMatrix: [3x2 double]
CorrectRate: 0.9762
ErrorRate: 0.0238
LastCorrectRate: 0.9762
LastErrorRate: 0.0238
InconclusiveRate: 0
ClassifiedRate: 1
Sensitivity: 1
Specificity: 0.9524
PositivePredictiveValue: 0.9545
NegativePredictiveValue: 1
PositiveLikelihood: 21
NegativeLikelihood: 0
Prevalence: 0.5000
DiagnosticTable: [2x2 double]
Acc =
0.9762
Sen =
1
Spe =
0.9524
conMat =
20 1
0 21
bc =
20
Label: ''
Description: ''
ClassLabels: {2x1 cell}
GroundTruth: [42x1 double]
NumberOfObservations: 42
ControlClasses: 2
TargetClasses: 1
ValidationCounter: 1
SampleDistribution: [42x1 double]
ErrorDistribution: [42x1 double]
SampleDistributionByClass: [2x1 double]
ErrorDistributionByClass: [2x1 double]
CountingMatrix: [3x2 double]
CorrectRate: 0.9762
ErrorRate: 0.0238
LastCorrectRate: 0.9762
LastErrorRate: 0.0238
InconclusiveRate: 0
ClassifiedRate: 1
Sensitivity: 1
Specificity: 0.9524
PositivePredictiveValue: 0.9545
NegativePredictiveValue: 1
PositiveLikelihood: 21
NegativeLikelihood: 0
Prevalence: 0.5000
DiagnosticTable: [2x2 double]
Acc =
0.9762
Sen =
1
Spe =
0.9524
conMat =
20 1
0 21
bc =
50
Label: ''
Description: ''
ClassLabels: {2x1 cell}
GroundTruth: [42x1 double]
NumberOfObservations: 42
ControlClasses: 2
TargetClasses: 1
ValidationCounter: 1
SampleDistribution: [42x1 double]
ErrorDistribution: [42x1 double]
SampleDistributionByClass: [2x1 double]
ErrorDistributionByClass: [2x1 double]
CountingMatrix: [3x2 double]
CorrectRate: 0.9762
ErrorRate: 0.0238
LastCorrectRate: 0.9762
LastErrorRate: 0.0238
InconclusiveRate: 0
ClassifiedRate: 1
Sensitivity: 1
Specificity: 0.9524
PositivePredictiveValue: 0.9545
NegativePredictiveValue: 1
PositiveLikelihood: 21
NegativeLikelihood: 0
Prevalence: 0.5000
DiagnosticTable: [2x2 double]
Acc =
0.9762
Sen =
1
Spe =
0.9524
conMat =
20 1
0 21
bc =
100
Label: ''
Description: ''
ClassLabels: {2x1 cell}
GroundTruth: [42x1 double]
NumberOfObservations: 42
ControlClasses: 2
TargetClasses: 1
ValidationCounter: 1
SampleDistribution: [42x1 double]
ErrorDistribution: [42x1 double]
SampleDistributionByClass: [2x1 double]
ErrorDistributionByClass: [2x1 double]
CountingMatrix: [3x2 double]
CorrectRate: 0.9762
ErrorRate: 0.0238
LastCorrectRate: 0.9762
LastErrorRate: 0.0238
InconclusiveRate: 0
ClassifiedRate: 1
Sensitivity: 1
Specificity: 0.9524
PositivePredictiveValue: 0.9545
NegativePredictiveValue: 1
PositiveLikelihood: 21
NegativeLikelihood: 0
Prevalence: 0.5000
DiagnosticTable: [2x2 double]
Acc =
0.9762
Sen =
1
Spe =
0.9524
conMat =
20 1
0 21
foldNo =
2
bc =
1
Label: ''
Description: ''
ClassLabels: {2x1 cell}
GroundTruth: [43x1 double]
NumberOfObservations: 43
ControlClasses: 2
TargetClasses: 1
ValidationCounter: 1
SampleDistribution: [43x1 double]
ErrorDistribution: [43x1 double]
SampleDistributionByClass: [2x1 double]
ErrorDistributionByClass: [2x1 double]
CountingMatrix: [3x2 double]
CorrectRate: 0.9302
ErrorRate: 0.0698
LastCorrectRate: 0.9302
LastErrorRate: 0.0698
InconclusiveRate: 0
ClassifiedRate: 1
Sensitivity: 1
Specificity: 0.8636
PositivePredictiveValue: 0.8750
NegativePredictiveValue: 1
PositiveLikelihood: 7.3333
NegativeLikelihood: 0
Prevalence: 0.4884
DiagnosticTable: [2x2 double]
Acc =
0.9302
Sen =
1
Spe =
0.8636
conMat =
19 3
0 21
bc =
2
Label: ''
Description: ''
ClassLabels: {2x1 cell}
GroundTruth: [43x1 double]
NumberOfObservations: 43
ControlClasses: 2
TargetClasses: 1
ValidationCounter: 1
SampleDistribution: [43x1 double]
ErrorDistribution: [43x1 double]
SampleDistributionByClass: [2x1 double]
ErrorDistributionByClass: [2x1 double]
CountingMatrix: [3x2 double]
CorrectRate: 0.9070
ErrorRate: 0.0930
LastCorrectRate: 0.9070
LastErrorRate: 0.0930
InconclusiveRate: 0
ClassifiedRate: 1
Sensitivity: 1
Specificity: 0.8182
PositivePredictiveValue: 0.8400
NegativePredictiveValue: 1
PositiveLikelihood: 5.5000
NegativeLikelihood: 0
Prevalence: 0.4884
DiagnosticTable: [2x2 double]
Acc =
0.9070
Sen =
1
Spe =
0.8182
conMat =
18 4
0 21
bc =
5
Label: ''
Description: ''
ClassLabels: {2x1 cell}
GroundTruth: [43x1 double]
NumberOfObservations: 43
ControlClasses: 2
TargetClasses: 1
ValidationCounter: 1
SampleDistribution: [43x1 double]
ErrorDistribution: [43x1 double]
SampleDistributionByClass: [2x1 double]
ErrorDistributionByClass: [2x1 double]
CountingMatrix: [3x2 double]
CorrectRate: 0.9070
ErrorRate: 0.0930
LastCorrectRate: 0.9070
LastErrorRate: 0.0930
InconclusiveRate: 0
ClassifiedRate: 1
Sensitivity: 1
Specificity: 0.8182
PositivePredictiveValue: 0.8400
NegativePredictiveValue: 1
PositiveLikelihood: 5.5000
NegativeLikelihood: 0
Prevalence: 0.4884
DiagnosticTable: [2x2 double]
Acc =
0.9070
Sen =
1
Spe =
0.8182
conMat =
18 4
0 21
bc =
10
Label: ''
Description: ''
ClassLabels: {2x1 cell}
GroundTruth: [43x1 double]
NumberOfObservations: 43
ControlClasses: 2
TargetClasses: 1
ValidationCounter: 1
SampleDistribution: [43x1 double]
ErrorDistribution: [43x1 double]
SampleDistributionByClass: [2x1 double]
ErrorDistributionByClass: [2x1 double]
CountingMatrix: [3x2 double]
CorrectRate: 0.9070
ErrorRate: 0.0930
LastCorrectRate: 0.9070
LastErrorRate: 0.0930
InconclusiveRate: 0
ClassifiedRate: 1
Sensitivity: 1
Specificity: 0.8182
PositivePredictiveValue: 0.8400
NegativePredictiveValue: 1
PositiveLikelihood: 5.5000
NegativeLikelihood: 0
Prevalence: 0.4884
DiagnosticTable: [2x2 double]
Acc =
0.9070
Sen =
1
Spe =
0.8182
conMat =
18 4
0 21
bc =
20
Label: ''
Description: ''
ClassLabels: {2x1 cell}
GroundTruth: [43x1 double]
NumberOfObservations: 43
ControlClasses: 2
TargetClasses: 1
ValidationCounter: 1
SampleDistribution: [43x1 double]
ErrorDistribution: [43x1 double]
SampleDistributionByClass: [2x1 double]
ErrorDistributionByClass: [2x1 double]
CountingMatrix: [3x2 double]
CorrectRate: 0.9070
ErrorRate: 0.0930
LastCorrectRate: 0.9070
LastErrorRate: 0.0930
InconclusiveRate: 0
ClassifiedRate: 1
Sensitivity: 1
Specificity: 0.8182
PositivePredictiveValue: 0.8400
NegativePredictiveValue: 1
PositiveLikelihood: 5.5000
NegativeLikelihood: 0
Prevalence: 0.4884
DiagnosticTable: [2x2 double]
Acc =
0.9070
Sen =
1
Spe =
0.8182
conMat =
18 4
0 21
bc =
50
Label: ''
Description: ''
ClassLabels: {2x1 cell}
GroundTruth: [43x1 double]
NumberOfObservations: 43
ControlClasses: 2
TargetClasses: 1
ValidationCounter: 1
SampleDistribution: [43x1 double]
ErrorDistribution: [43x1 double]
SampleDistributionByClass: [2x1 double]
ErrorDistributionByClass: [2x1 double]
CountingMatrix: [3x2 double]
CorrectRate: 0.9070
ErrorRate: 0.0930
LastCorrectRate: 0.9070
LastErrorRate: 0.0930
InconclusiveRate: 0
ClassifiedRate: 1
Sensitivity: 1
Specificity: 0.8182
PositivePredictiveValue: 0.8400
NegativePredictiveValue: 1
PositiveLikelihood: 5.5000
NegativeLikelihood: 0
Prevalence: 0.4884
DiagnosticTable: [2x2 double]
Acc =
0.9070
Sen =
1
Spe =
0.8182
conMat =
18 4
0 21
bc =
100
Label: ''
Description: ''
ClassLabels: {2x1 cell}
GroundTruth: [43x1 double]
NumberOfObservations: 43
ControlClasses: 2
TargetClasses: 1
ValidationCounter: 1
SampleDistribution: [43x1 double]
ErrorDistribution: [43x1 double]
SampleDistributionByClass: [2x1 double]
ErrorDistributionByClass: [2x1 double]
CountingMatrix: [3x2 double]
CorrectRate: 0.9070
ErrorRate: 0.0930
LastCorrectRate: 0.9070
LastErrorRate: 0.0930
InconclusiveRate: 0
ClassifiedRate: 1
Sensitivity: 1
Specificity: 0.8182
PositivePredictiveValue: 0.8400
NegativePredictiveValue: 1
PositiveLikelihood: 5.5000
NegativeLikelihood: 0
Prevalence: 0.4884
DiagnosticTable: [2x2 double]
Acc =
0.9070
Sen =
1
Spe =
0.8182
conMat =
18 4
0 21
foldNo =
3
bc =
1
Label: ''
Description: ''
ClassLabels: {2x1 cell}
GroundTruth: [43x1 double]
NumberOfObservations: 43
ControlClasses: 2
TargetClasses: 1
ValidationCounter: 1
SampleDistribution: [43x1 double]
ErrorDistribution: [43x1 double]
SampleDistributionByClass: [2x1 double]
ErrorDistributionByClass: [2x1 double]
CountingMatrix: [3x2 double]
CorrectRate: 0.9535
ErrorRate: 0.0465
LastCorrectRate: 0.9535
LastErrorRate: 0.0465
InconclusiveRate: 0
ClassifiedRate: 1
Sensitivity: 0.9545
Specificity: 0.9524
PositivePredictiveValue: 0.9545
NegativePredictiveValue: 0.9524
PositiveLikelihood: 20.0455
NegativeLikelihood: 0.0477
Prevalence: 0.5116
DiagnosticTable: [2x2 double]
Acc =
0.9535
Sen =
0.9545
Spe =
0.9524
conMat =
20 1
1 21
bc =
2
Label: ''
Description: ''
ClassLabels: {2x1 cell}
GroundTruth: [43x1 double]
NumberOfObservations: 43
ControlClasses: 2
TargetClasses: 1
ValidationCounter: 1
SampleDistribution: [43x1 double]
ErrorDistribution: [43x1 double]
SampleDistributionByClass: [2x1 double]
ErrorDistributionByClass: [2x1 double]
CountingMatrix: [3x2 double]
CorrectRate: 0.9535
ErrorRate: 0.0465
LastCorrectRate: 0.9535
LastErrorRate: 0.0465
InconclusiveRate: 0
ClassifiedRate: 1
Sensitivity: 0.9545
Specificity: 0.9524
PositivePredictiveValue: 0.9545
NegativePredictiveValue: 0.9524
PositiveLikelihood: 20.0455
NegativeLikelihood: 0.0477
Prevalence: 0.5116
DiagnosticTable: [2x2 double]
Acc =
0.9535
Sen =
0.9545
Spe =
0.9524
conMat =
20 1
1 21
bc =
5
Label: ''
Description: ''
ClassLabels: {2x1 cell}
GroundTruth: [43x1 double]
NumberOfObservations: 43
ControlClasses: 2
TargetClasses: 1
ValidationCounter: 1
SampleDistribution: [43x1 double]
ErrorDistribution: [43x1 double]
SampleDistributionByClass: [2x1 double]
ErrorDistributionByClass: [2x1 double]
CountingMatrix: [3x2 double]
CorrectRate: 0.9535
ErrorRate: 0.0465
LastCorrectRate: 0.9535
LastErrorRate: 0.0465
InconclusiveRate: 0
ClassifiedRate: 1
Sensitivity: 0.9545
Specificity: 0.9524
PositivePredictiveValue: 0.9545
NegativePredictiveValue: 0.9524
PositiveLikelihood: 20.0455
NegativeLikelihood: 0.0477
Prevalence: 0.5116
DiagnosticTable: [2x2 double]
Acc =
0.9535
Sen =
0.9545
Spe =
0.9524
conMat =
20 1
1 21
bc =
10
Label: ''
Description: ''
ClassLabels: {2x1 cell}
GroundTruth: [43x1 double]
NumberOfObservations: 43
ControlClasses: 2
TargetClasses: 1
ValidationCounter: 1
SampleDistribution: [43x1 double]
ErrorDistribution: [43x1 double]
SampleDistributionByClass: [2x1 double]
ErrorDistributionByClass: [2x1 double]
CountingMatrix: [3x2 double]
CorrectRate: 0.9535
ErrorRate: 0.0465
LastCorrectRate: 0.9535
LastErrorRate: 0.0465
InconclusiveRate: 0
ClassifiedRate: 1
Sensitivity: 0.9545
Specificity: 0.9524
PositivePredictiveValue: 0.9545
NegativePredictiveValue: 0.9524
PositiveLikelihood: 20.0455
NegativeLikelihood: 0.0477
Prevalence: 0.5116
DiagnosticTable: [2x2 double]
Acc =
0.9535
Sen =
0.9545
Spe =
0.9524
conMat =
20 1
1 21
bc =
20
Label: ''
Description: ''
ClassLabels: {2x1 cell}
GroundTruth: [43x1 double]
NumberOfObservations: 43
ControlClasses: 2
TargetClasses: 1
ValidationCounter: 1
SampleDistribution: [43x1 double]
ErrorDistribution: [43x1 double]
SampleDistributionByClass: [2x1 double]
ErrorDistributionByClass: [2x1 double]
CountingMatrix: [3x2 double]
CorrectRate: 0.9535
ErrorRate: 0.0465
LastCorrectRate: 0.9535
LastErrorRate: 0.0465
InconclusiveRate: 0
ClassifiedRate: 1
Sensitivity: 0.9545
Specificity: 0.9524
PositivePredictiveValue: 0.9545
NegativePredictiveValue: 0.9524
PositiveLikelihood: 20.0455
NegativeLikelihood: 0.0477
Prevalence: 0.5116
DiagnosticTable: [2x2 double]
Acc =
0.9535
Sen =
0.9545
Spe =
0.9524
conMat =
20 1
1 21
bc =
50
Label: ''
Description: ''
ClassLabels: {2x1 cell}
GroundTruth: [43x1 double]
NumberOfObservations: 43
ControlClasses: 2
TargetClasses: 1
ValidationCounter: 1
SampleDistribution: [43x1 double]
ErrorDistribution: [43x1 double]
SampleDistributionByClass: [2x1 double]
ErrorDistributionByClass: [2x1 double]
CountingMatrix: [3x2 double]
CorrectRate: 0.9535
ErrorRate: 0.0465
LastCorrectRate: 0.9535
LastErrorRate: 0.0465
InconclusiveRate: 0
ClassifiedRate: 1
Sensitivity: 0.9545
Specificity: 0.9524
PositivePredictiveValue: 0.9545
NegativePredictiveValue: 0.9524
PositiveLikelihood: 20.0455
NegativeLikelihood: 0.0477
Prevalence: 0.5116
DiagnosticTable: [2x2 double]
Acc =
0.9535
Sen =
0.9545
Spe =
0.9524
conMat =
20 1
1 21
bc =
100
Label: ''
Description: ''
ClassLabels: {2x1 cell}
GroundTruth: [43x1 double]
NumberOfObservations: 43
ControlClasses: 2
TargetClasses: 1
ValidationCounter: 1
SampleDistribution: [43x1 double]
ErrorDistribution: [43x1 double]
SampleDistributionByClass: [2x1 double]
ErrorDistributionByClass: [2x1 double]
CountingMatrix: [3x2 double]
CorrectRate: 0.9767
ErrorRate: 0.0233
LastCorrectRate: 0.9767
LastErrorRate: 0.0233
InconclusiveRate: 0
ClassifiedRate: 1
Sensitivity: 1
Specificity: 0.9524
PositivePredictiveValue: 0.9565
NegativePredictiveValue: 1
PositiveLikelihood: 21
NegativeLikelihood: 0
Prevalence: 0.5116
DiagnosticTable: [2x2 double]
Acc =
0.9767
Sen =
1
Spe =
0.9524
conMat =
20 1
0 22
>>
this is the output from bc=1,2,5,10,20,50 to bc=100 from kfold 1 to kfold 3
i need to use array to store and get average of the sensitivity, specificity and accuracy from the all k-fold
Walter Roberson
2015년 10월 16일
You need to show your code, as I have no idea which routine is producing the output you are showing.
Need Help
2015년 10월 16일
This is my code. hope can help.
clear all, close all, clc
%%LOAD SALIVA DATA (ROI_nobase)
myfile=uigetfile('*.mat','MAT-files (*.mat)');
my_data=load(myfile);
mixture = struct2cell (my_data);
mixture = cell2mat (mixture);
%% LOAD MIXTURE DATA (ROI_nobase1)
myfile=uigetfile('*.mat','MAT-files (*.mat)');
my_data=load(myfile);
saliva = struct2cell (my_data);
saliva = cell2mat (saliva);
%%
spot = input('insert no of PC=')
N=size(saliva,1);
N1=size(mixture,1);
data=[saliva(:,1:spot);mixture(:,1:spot)];
% data=[saliva;mixture];
Ndata=size(data,1);
labelsaliva={'saliva'};labelmix={'mixture'};
Y=nominal([repmat(labelsaliva,N,1);repmat(labelmix,N1,1)]);
K = input('insert K-fold=')
indices = crossvalind('Kfold',Y,K);
for i = 1:K
figure
foldNo=i
test = (indices == i);
train = ~test;
bcvals = [1 2 5 10 20 50 100];
for K = 1 : length(bcvals)
bc = bcvals(K)
SVMStruct{K} = svmtrain( data(train,:), Y(train), 'Kernel_Function', 'linear', 'BoxConstraint',bc, 'showplot', true);
%%
Group = svmclassify(SVMStruct{K},data(test,:),'showplot', true);
hold off;
grp1=Y(test);
testset=data(test,:);
hold on
mydiff = (Group == grp1(:,1)); % classified correctly
for j = mydiff
plot ( testset (j ,1) , testset (j ,2) ,'ro ', 'MarkerSize' ,15)
end
for j = not( mydiff ) % check plot black circles misclass
plot ( testset (j ,1) , testset (j ,2) ,'bo ', 'MarkerSize' ,15)
end
hold off;
%%
cp = classperf(grp1);
classperf(cp,Group)
Acc=cp.CorrectRate
Sen=cp.Sensitivity
Spe=cp.Specificity
hold off;
conMat = confusionmat(grp1,Group)
hold on;
% Group = double(Group);
% [X1,Y1,T,AUC] = perfcurve(Y(test),Group,'saliva');
% plot(X1,Y1)
% xlabel('False positive rate'); ylabel('True positive rate')
% title('ROC for classification by SVM')
% Group = nominal(Group)
end
end
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
아시아 태평양
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)