How to declare kfun function in svmtrain
1 次查看(过去 30 天)
显示 更早的评论
Hi all
i want to train data using polynomial kernel which have:
gamma, C, r, d.
svmtrain only has boxConstraint (C) and Polyorder (d)
so i have to declare function by my self using @kfun
i've tried many times but still got "*Function definitions are not permitted in this context.*"
where i must put this code?
function K = kfun(U,V,gamma,r)
K = gamma*(U*V')+r;
in command line and in .m script file I still got error like that
anybody can help me?
thanks before
1 个评论
Ahmed
2013-6-13
You are probably trying to define a function in a script file. This is not possible. Put your function in a separate m-File called kfun.m or define an anonymous function.
kfun = @(U,V,gamma,r) gamma*(U*V')+r;
回答(1 个)
另请参阅
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!