forked from laumann/statml
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce tables in report with results from modifying the parameter C after model has been selected. Misses the analysis. Introduce another table showing the optimal values for C and gamma after model selection by grid-search.
- Loading branch information
Thomas Bracht Laumann Jespersen
committed
Mar 18, 2012
1 parent
c6ede21
commit f601ee1
Showing
6 changed files
with
102 additions
and
16 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
|
||
|
||
data = loadknoll('knollC-train200.dt'); | ||
|
||
[C gamma] = modelselect(data); | ||
|
||
model = train(data, C, gamma) | ||
modelLarger = train(data, C*100, gamma) | ||
modelSmaller = train(data, C/100, gamma) | ||
|
||
[f b] = dividesupportvectors(C, model.SVs, model.sv_coef); | ||
[fl bl] = dividesupportvectors(C, modelLarger.SVs, modelLarger.sv_coef); | ||
[fs bs] = dividesupportvectors(C, modelSmaller.SVs, ... | ||
modelSmaller.sv_coef); | ||
|
||
disp(sprintf('Original: #SVs: %d\t#free SVs: %d\t#bounded SVs: %d', ... | ||
length(model.SVs), length(f), length(b))); | ||
disp(sprintf('C*100: #SVs: %d\t#free SVs: %d\t#bounded SVs: %d', ... | ||
length(modelLarger.SVs), length(fl), length(bl))); | ||
disp(sprintf('C/100: #SVs: %d\t#free SVs: %d\t#bounded SVs: %d', ... | ||
length(modelSmaller.SVs), length(fs), length(bs))); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
function [ model ] = train( data, labels, c, gamma ) | ||
function [ model ] = train(knolldata, c, gamma ) | ||
%% Trains the SVM on the given data using the given parameters. | ||
%% Returns libsvm model data which can then be used with svmpredict. | ||
commandstring = sprintf('-s 0 -t 2 -g %d -c %d', gamma, c); | ||
model = svmtrain(labels, data, commandstring); | ||
model = svmtrain(knolldata(:,3), knolldata(:,1:2), commandstring); | ||
|
||
end |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters