source: trunk/lib/classifier/KernelWeighted_SEV.cc @ 513

Last change on this file since 513 was 513, checked in by Peter, 16 years ago

added kernels using weights

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 907 bytes
Line 
1// $Id: KernelWeighted_SEV.cc 513 2006-02-18 16:02:43Z peter $
2
3#include <c++_tools/classifier/KernelWeighted_SEV.h>
4
5#include <c++_tools/classifier/Kernel.h>
6#include <c++_tools/classifier/KernelFunction.h>
7#include <c++_tools/gslapi/matrix.h>
8#include <c++_tools/gslapi/vector.h>
9
10namespace theplu {
11namespace classifier { 
12
13
14KernelWeighted_SEV::KernelWeighted_SEV(const gslapi::matrix& data, 
15                                       const KernelFunction& kf, 
16                                       const gslapi::matrix& weights)
17  : Kernel(data,kf), weights_(weights)
18{
19  kernel_matrix_ = gslapi::matrix(data.columns(),data.columns());
20  for (size_t i=0; i<kernel_matrix_.rows(); i++) 
21    for (size_t j=i; j<kernel_matrix_.columns(); j++) 
22      kernel_matrix_(i,j) = kernel_matrix_(j,i) =
23        (*kf_)(gslapi::vector(data_,i,false),gslapi::vector(data_,j,false), 
24               gslapi::vector(weights_,i,false),
25               gslapi::vector(weights_,j,false));
26}
27
28
29}} // of namespace classifier and namespace theplu
Note: See TracBrowser for help on using the repository browser.