svm_out_reg - %alph is assumed to be in column%first we...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
%% now we will produce a function that computes the output of the svm %% directly. that is w'*fi(x) + d. function [val] = svm_out_reg(xtest,xtrain,alph,d,sg) %xtrain: xtrain must be in this form. each column is a seperate training %data. it is assumed to be in this form. %xtest : xtest is also in the form of xtrain. that is columns are seperate %training datas. xtest means the new data.
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: %alph : is assumed to be in column. %first we have to compute the kernel matrix. K is N by 1 in this case. %first of all obtain the size of training data thus the kernel matrix [m,n] = size(xtrain); if(m>n) sizeK = m; else sizeK = n; end K=zeros(sizeK,1); for i = 1:sizeK K(i,1) = exp(- ((norm( xtrain(:,i) - xtest ))^2)/(2*sg^2) ); end val = alph'*K(:,1) + d;...
View Full Document

This note was uploaded on 07/04/2011 for the course ECE 501 taught by Professor Deniz during the Spring '11 term at Istanbul Universitesi.

Ask a homework question - tutors are online