diff options
| author | Gertjan van den Burg <gertjanvandenburg@gmail.com> | 2017-02-17 19:02:52 -0500 |
|---|---|---|
| committer | Gertjan van den Burg <gertjanvandenburg@gmail.com> | 2017-02-17 19:02:52 -0500 |
| commit | 3a30e992cf022f4ec3c76506c070e59d093951d4 (patch) | |
| tree | fe14713d50876c1d37f1acec40b9a77875d2bba3 /tests/aux | |
| parent | minor code clarification (diff) | |
| download | gensvm-3a30e992cf022f4ec3c76506c070e59d093951d4.tar.gz gensvm-3a30e992cf022f4ec3c76506c070e59d093951d4.zip | |
Remove kernelparam array in favour of explicit kernel parameters
This simplifies a lot of the code and will make it easier to link
to other languages.
Diffstat (limited to 'tests/aux')
| -rw-r--r-- | tests/aux/test_kernel_dot_sparse.m | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/aux/test_kernel_dot_sparse.m b/tests/aux/test_kernel_dot_sparse.m new file mode 100644 index 0000000..86a439e --- /dev/null +++ b/tests/aux/test_kernel_dot_sparse.m @@ -0,0 +1,25 @@ +#function test_kernel_dot_sparse(kerneltype) + + kerneltype = 'rbf'; + + X = [1 2 0 0 0 0; + 0 3 0 4 0 0; + 0 0 5 6 7 0; + 0 0 0 0 0 8]; + [n, m] = size(X); + spZ = sparse([ones(n, 1), X]); + + gamma = 0.05; + degree = 1.7; + const = 0.75; + + K = zeros(n, n); + if strcmp(kerneltype, 'rbf') + for i=1:n + for j=1:n + K(i, j) = exp(-gamma * sum((spZ(i, 2:end) - spZ(j, 2:end)).^2)); + end + end + end + +#end
\ No newline at end of file |
