Search
Program:
Downloads:
Likely, you will not manage to finish the implementation of all the functions during the excercise in the lab. Finish them as a home work.
stprpath
compilemex
Answer the following questions:
svm2()
bsvm2()
svmclass()
Output of all training algorithms in the STPR toolbox is a structure called a model. After using the svm2 function, the model structure may look like this:
model
svm2
model = Alpha: [40x1 double] b: -2.3417 sv: [1x1 struct] nsv: 40 W: [64x1 double] options: [1x1 struct] kercnt: 46909 trnerr: 0 errcnt: 0 exitflag: 2 stat: [1x1 struct] cputime: 0.1993 fun: 'svmclass'
The structure contains all the information needed to use a SVM classifier:
model.Alpha
model.b
model.W
linear
model.W'*x + model.b
model.sv
X
y
model.fun
linclass
svmclass
options
What exactly do we check by the following command?
all(model.sv.X * model.Alpha == model.W)
Use the scripts from the last week where you classified the wedge and XOR datasets using neural networks from NETLAB toolbox.
pboundary()
pareas()
pwpatterns()
% Create a new figure figure; hold on; % Fill areas that belong to classes 1 and 2, respectively ha = pareas(model); % Plot the data, distinguished by colors hx = pwpatterns(data); % Plot circles around the support vectors plot(model.sv.X(1,:), model.sv.X(2,:),'ko', 'Linewidth', 2, 'MarkerSize',8); % Plot the boundary between classes and make it thicker hl = pboundary(model); set(hl,'Linewidth',3,'color','k');
Explore:
Use the hand-written digits dataset as data for classification.
errRate()
confmat()
Training of multiclass SVM can be done e.g. by bsvm2() function.
perceptron()
linclass()
trainClassLinearPerceptron()
predClassLinear()
demo_linclass
demo_svm