-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from ratiopharm88/master
Changes from friday
- Loading branch information
Showing
9 changed files
with
1,139 additions
and
11 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
function [class1 class2] = dividedataset (A) | ||
%% Divides a given set of two dimensional classification data into one set for each class. | ||
%% The classes must be encoded by being 1 for the first class and different from one for the second. | ||
%% | ||
%% A - the input data set | ||
class1=ones(0,2); | ||
class2=ones(0,2); | ||
for i=1:length(A) | ||
if A(i,3)==1 | ||
class1=[class1;A(i,1),A(i,2)]; | ||
else | ||
class2=[class2;A(i,1),A(i,2)]; | ||
end | ||
end | ||
|
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,17 @@ | ||
function [free bounded] = dividesupportvectors (c, SVs, SVcoeffs) | ||
%% Takes a matrix containing all support vectors of a trained C-SVM | ||
%% and divides it into free and bounded support vectors. | ||
|
||
free=ones(0, size(SVs, 2)); | ||
bounded=ones(0, size(SVs, 2)); | ||
|
||
for i=1:length(SVcoeffs) | ||
current= SVs(i,:); | ||
if c==abs(SVcoeffs(i)) | ||
bounded=[bounded; current]; | ||
else | ||
free=[free; current]; | ||
end | ||
end | ||
|
||
end |
Oops, something went wrong.