Mercurial > hg > camir-ismir2012
comparison core/tools/machine_learning/svmlight2weight.m @ 0:cc4b1211e677 tip
initial commit to HG from
Changeset:
646 (e263d8a21543) added further path and more save "camirversion.m"
author | Daniel Wolff |
---|---|
date | Fri, 19 Aug 2016 13:07:06 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:cc4b1211e677 |
---|---|
1 function w = svmlight2weight(modelfile) | |
2 % returns the dual weight vecor for a given svm model | |
3 % | |
4 % All the script does is compute the weighted sum of the support vectors | |
5 % (first element in line is alpha*y, what follows is the feature vector). | |
6 % For further info, see the comment in the model file for its format. | |
7 | |
8 tagstr = python('svmlight2weight.py', modelfile); | |
9 | |
10 [firstidx] = strfind(tagstr, '1 :'); | |
11 | |
12 %get start of vector description | |
13 tagstr = tagstr(firstidx:end); | |
14 | |
15 % parse text function output | |
16 vecs = textscan(tagstr,'%d %f','Delimiter',':'); | |
17 | |
18 % initialise | |
19 w = zeros(max(vecs{1}),1); | |
20 | |
21 % set values | |
22 w(vecs{1}) = vecs{2}; | |
23 |