現在この質問をフォロー中です
- フォローしているコンテンツ フィードに更新が表示されます。
- コミュニケーション基本設定に応じて電子メールを受け取ることができます。
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!エラーが発生しました
ページに変更が加えられたため、アクションを完了できません。ページを再度読み込み、更新された状態を確認してください。
Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の 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 (한국어)